Skip to content

Instantly share code, notes, and snippets.

@grahaml
Last active June 24, 2017 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahaml/0845dc02c727222c08f6f21454a350e4 to your computer and use it in GitHub Desktop.
Save grahaml/0845dc02c727222c08f6f21454a350e4 to your computer and use it in GitHub Desktop.
Roll the dice
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