Last active
June 24, 2017 01:43
-
-
Save grahaml/0845dc02c727222c08f6f21454a350e4 to your computer and use it in GitHub Desktop.
Roll the dice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def roll(sides=6): | |
return random.randint(1, sides) | |
def main(): | |
sides = 6 | |
rolling = True | |
while rolling: | |
roll_again = input('Roll the dice? Yes = Enter, No = Q') | |
if roll_again.lower() != 'q': | |
print(roll(sides)) | |
print('did you get what you bet on?') | |
else: | |
rolling = False | |
print('thanks for playing') | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment