dimanche 9 octobre 2022

random dice rolling game. adding up the sum of values 1,3,4,and 6 excluding 2 and 5 in python

Im trying to make a loop where I start with 5 random dice rolls. the values 1,3,4, and 6 are added up for your score, while 2s and 5s are not counted and subtract the combined amount of dice rolled with 2s and 5s from the amount of dice rolled the next turn. I can't quite figure out how to get the sum of only the dice that rolled 1,3,4,6 and roll a lesser amount of dice the next turn based off ho many dice were 2 or 5


#Stuck in the Mud Dice Game

Exit = 0
Rolls = int(5)
score = 0
def RollDice():
    totalsum = 0
    for die in range(0, Rolls):
        number = random.randint(1,6)
        print("die", die + 1, ":", number)
        totalsum += number
    print("score: ", totalsum) 
    
    

def Menu():
    print("1. Roll Dice")
    print("2. Exit Program")
    print()
    choice = int(input("Enter option here: "))

    if(choice == 1):
        RollDice()
    if(choice == 2):
        Exit()
Menu()



Aucun commentaire:

Enregistrer un commentaire