Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This program took me a bit. Through a lot of research and asking questions,
- #i learned that putting the statement in a while True loop allowed the program
- #to repeat the question and continue letting the user ask to roll a dice
- import random
- while True:
- print()
- userInput = input('Roll dice? (y/n) \n >')
- if userInput == 'y':
- foo = ['1', '2', '3', '4', '5', '6']
- print(random.choice(foo))
- elif userInput == 'n':
- print('No number shall be rolled.')
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement