inggogl.blogg.se

I just asked for the time tails
I just asked for the time tails






Here's some more details, including descriptions of any command-line arguments. My preferred style for a script (as opposed to library) module is something like: """This docstring explains the program's purpose. This makes it easier to read and easier to debug. In other words, you should be able to import your module without running your program.

I just asked for the time tails code#

Top-level code in a module should generally be definitions only, not "executable" code. Guess = easygui.buttonbox("Pick one", choices=CHOICES)Įasygui.msgbox("Sorry you guessed wrong!") Import easygui # third-party modules after standard-library modulesĬHOICES = # ALL_CAPS for variables whose value never changes With all the changes made and after applying the rules from the the Python style guide PEP8, your code looks like this: import random # alphabetic order

i just asked for the time tails

Or simply: if not easygui.ynbox("Play again?"): To this: play_again = easygui.ynbox("Play again?") So you can change this: answer = easygui.buttonbox("Play again?", choices=) I don't know easygui, but it seems you should use a You can simplify this: if answer = "Yes": Don't write twice, because if you have to change it for whatever reason, you have to remember to change it in two places. rand is not very descriptive and firstguess is plain incorrect (every guess, not just the first, gets assigned to this variable).ĭon't repeat yourself. You don't need sys.exit(0) at the end of your script, since Python will exit automatically when it reaches the end.Ĭhoose your variable names carefully. ( It is recommended that you use spaces only.) Good editors have a setting that will help you with this. The fact that your code broke when you pasted it here shows why.

i just asked for the time tails

But there is always room for improvement:






I just asked for the time tails