Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #2 dice - random throw
- import random # import outside the loop
- def dice_throw():
- rolls = int(input("How many times would you like to roll the dice? "))
- while rolls > 0:
- diceone = random.randint(1,6) # these inside the while loop
- dicetwo = random.randint(1,6) # so you get a new roll each time
- print("First dice = ",diceone)
- print("Second dice = ",dicetwo)
- rolls = rolls -1
- print ("Number of rolls left = ",rolls)
- dice_throw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement