-
Notifications
You must be signed in to change notification settings - Fork 12.6k
A dice rolling simulation script #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
A beginner project for people wanting an example of how you can use while loops, and random. Key parts of the code is commented, may comment more later to help explain. I am a little new to Python myself, so please feel free to let me know of any better techniques I can use!
#Checking the user input to start the program. | ||
while correct_word == False: | ||
|
||
user_input_raw = raw_input("\r\nWelcome to the Dice Rolling Simulator! We currently support 6, 8, and 12 sided die! Type [start] to begin!\r\n?>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompt string is too long for one line. You may have a variable named prompt_str, and use () to limit characters number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sooo dramtic the words you uesd!!
else: | ||
print "\r\nPlease choose one of the applicable options!\r\n" | ||
|
||
#Another inner while loop. This one does the actual rolling, as well as allowing the user to re-roll without restarting the program. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate the comment to multiple lines because it's too long.
while dicer == False: | ||
|
||
if user_dice_chooser == 6: | ||
dice_6 = random.randint(1,6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there are too many duplicated codes, could you abstract them (line 68~ 79, line 53~64, etc) to a function.
roller_loop = True | ||
|
||
print "Thanks for using the Dice Rolling Simulator! Have a great day! =)" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all right.Good job! but too many dulplicated contents you know,like another reviewer said.
Thank you for you contribution to the repo and the community
…On 28 May 2017, at 03:33, SlimxShadyx ***@***.***> wrote:
A beginner project for people wanting an example of how you can use while loops, and random.
Key parts of the code is commented, may comment more later to help explain.
I am a little new to Python myself, so please feel free to let me know of any better techniques I can use!
You can view, comment on, or merge this pull request online at:
#170
Commit Summary
A dice rolling simulation script
File Changes
A dice_rolling_simulator.py (96)
Patch Links:
https://github.com/geekcomputers/Python/pull/170.patch
https://github.com/geekcomputers/Python/pull/170.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks for merging and all the tips! :) |
A beginner project for people wanting an example of how you can use while loops, and random.
Key parts of the code is commented, may comment more later to help explain.
I am a little new to Python myself, so please feel free to let me know of any better techniques I can use!