Python

it’s so funny

# if you can’t understand,please run it in your IDE

by the way,i’m chinese

letter = [‘a’,‘b’,‘c’,‘d’,‘e’,‘f’,‘g’,‘h’,‘i’,‘j’,‘k’,‘l’,‘m’,‘n’,‘o’,‘p’,‘q’,‘r’,‘s’,‘t’,‘u’,‘v’,‘w’,‘x’,‘y’,‘z’,’ ']
number = [8,26,13,4,4,3,26,0,26,5,14,17,4,8,6,13,26,5,17,8,4,13,3]
message = “”

for i in number:
message += letter[i]

1 Like

Hello @simon14789,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the Programming Help and Discussion board. No action is needed on your part; you can continue the conversation as normal here.

Let me know if you have any other questions or if I can help with anything else.

Greatly appreciated,

-MChevy422

1 Like

The code write like this cannot work, the for loop need spaces. Something like this:

letter = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ']
number = [8,26,13,4,4,3,26,0,26,5,14,17,4,8,6,13,26,5,17,8,4,13,3]
message = ""

for i in number:
    message += letter[i]

Another thing you need to print the output otherwise it will not print anything:

letter = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ']
number = [8, 26, 13, 4, 4, 3, 26, 0, 26, 5, 14, 17, 4, 8, 6, 13, 26, 5, 17, 8, 4, 13, 3]
message = ""

for i in number:
    message += letter[i]

print(message)

One last thing, please read the “Conventions for the Python code” here: https://www.python.org/dev/peps/pep-0008/

The code will be more readable and beauty if you follow it:

letter = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
          'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ']
number = [8, 26, 13, 4, 4, 3, 26, 0, 26, 5, 14,
          17, 4, 8, 6, 13, 26, 5, 17, 8, 4, 13, 3]
message = ""

for i in number:
    message += letter[i]

print(message)

If you do that we can be friends :slightly_smiling_face:

-Gabriele-

3 Likes

What!Where is my space!There are spaces in my IDE,But I don’t know why it’s gone when it’s copied.Thank you for helping me find it.I’m going to reissue it now.What text editor do you use? It looks good. It’s different from mine.

I use Atom for scripting languages

How long do programmers work in your country?I’m working now. Most Chinese programmers should be working now!Working hours in China range from 8 a.m. to around 10 p.m.

Good question @simon14789! I can only speak for my country and I live in the United States.

Here, programmers tend to have a decent amount of freedom to choose a schedule that works for them as they can work for big corporations, small startups, or even as independent contractors.

As a cultural average, people tend to try to work 35-45 hours a week. However, it’s not uncommon for some companies to expect their workers to work 60 hours during certain weeks when they’re trying to get things done before a deadline. These are called crunch weeks. There are mixed feelings about crunch periods as a lot can get done, but they tend to produce sloppy work and cause burnout for people as they’re pushed beyond their limit of being able to take care of themselves.

1 Like

 I am so new to Python, I can hardly understand anything

I am taking it this semester, can anyone volunteer to help me please

@marcsultan wrote:

 I am so new to Python, I can hardly understand anything

I am taking it this semester, can anyone volunteer to help me please

Feel free to post your questions or confusion as new topics in this forum.

Good luck with your studies!

1 Like