import random
while True:
dice = random.randrange(1,5)
dice2 = random.randrange(1,7)
dice3 = random.randrange(1,13)
sides = int(input)("Which sided dice would you like to roll? You can choose a 4-sided dice, a 6-sided dice or a 12-sided dice. Type 0 to exit the loop.")
if sides ==0:
break
elif sides ==4:
print ("The 4-sided dice has rolled to", dice)
elif sides ==6:
print ("The 6-sided dice has rolled to", dice2)
elif sides ==12:
print ("The 12-sided dice has rolled to", dice3)
else:
print ("Please input a number 4, 6 or 12")
This is my fully working code. I am just stuck on my pseudo code and algorithm for this coding.
Here is a quick summary of what is going on in the code:
The user gets to choose between a 4, 6 or 12 sided dice. When the user chooses an option, they can repeat the process as many times as necessary or choose to exit the loop.