Below is my code. This is basically a petals around the rose thing im doing. If youre not familiar with this game its basically predicting the value of the roll of x amount of dices, in which dice with values 1,2,4,6 = 0 and dice with values 3 = 2 and dice with values 5 = 4 Here is my code.
die1 = random.randint(1,6)
die2 = random.randint(1,6)
die3 = random.randint(1,6)
die4 = random.randint(1,6)
die5 = random.randint(1,6)
result = display_dice(die1, die2, die3, die4, die5)
roll_guess = int(input("please enter your guess for the roll:"))
def dicevalue(die1):
if die1 == 1 or die1 == 2 or die1 == 4 or die1 == 6:
die1 == 0
elif die1 == 3:
die1 == 2
elif die1 ==5:
die1 == 4
return die1
print(dicevalue(die1))
I also tried this and I got an error
for values in die1:
if die1 == 1 or die1 == 2 or die1 == 4 or die1 == 6:
die1 == 0
elif die1 == 3:
die1 == 2
elif die1 ==5:
die1 == 4
as you can see, I would like to summarise this code in terms of dice[i] to calculate all of them but I dont know how to. So i took the long approach to tell python what I just told you in the first paragraph. I am new to python so if the mistakes looks stupid please excuse my stupidity. thanksss
Aucun commentaire:
Enregistrer un commentaire