Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 9

Python

Solved! Go to Solution.

# 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]

8 Replies
Moderator
Message 2 of 9

Re: Python

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

 

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Solution
Commander Lvl 2
Message 3 of 9

Re: Python

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 🙂

 

-Gabriele-

 

Copilot Lvl 2
Message 4 of 9

Re: Python

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.
Commander Lvl 2
Message 5 of 9

Re: Python

I use Atom for scripting languages

Copilot Lvl 2
Message 6 of 9

Re: Python

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.
Community Manager
Message 7 of 9

Re: Python

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.

Ground Controller Lvl 2
Message 8 of 9

Re: Python

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

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

Commander Lvl 2
Message 9 of 9

Re: Python


@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!

 

Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!