Python Forum

Full Version: simple dice roll
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

Very new to programming.

Could anyone say how to point user input to dice value not dice number, I got this far:

import random

current_score = 0

dice1 = random.randrange(1,7)
dice2 = random.randrange(1,7)
dice3 = random.randrange(1,7)
dice4 = random.randrange(1,7)
dice5 = random.randrange(1,7)
all_dice = dice1, dice2, dice3, dice4, dice5 
print("Your dice:", dice1, dice2, dice3, dice4, dice5)
print()
all_dice1 = str(all_dice)
user_input = input("Dice:")
user_input = str(all_dice)[0:4]


print(user_input)
Thanks
If they give the value showing on the die (note that die is the singular of dice), you can find the first die with that value with all_dice.index(value).