Expand your horizons with the diverse and informative answers found on IDNLearn.com. Get accurate and detailed answers to your questions from our knowledgeable and dedicated community members.
Sagot :
Answer:
def dice_roller():
# ask for first input
input1 = int(input("Enter the first roll: "))
# check if it's valid
while input1 < 1 or input1 > 6:
print("Invalid number")
# ask for new input if the previous was invalid
input1 = int(input("Enter the first roll: "))
# ask for second input
input2 = int(input("Enter the second roll: "))
# check if it's valid
while input2 < 1 or input2 > 6:
print("Invalid number")
# ask for new input if the previous was invalid
input2 = int(input("Enter the second roll: "))
# check of the numbers are the same
if input1 == input2:
print("You rolled the same numbers. Try again")
# if they are the same call this function again to get new numbers
dice_roller()
else:
# print how many spaces to advance
print("Advance", input1+input2, "spaces")
if __name__ == '__main__':
dice_roller()
We value your presence here. Keep sharing knowledge and helping others find the answers they need. This community is the perfect place to learn together. Find the answers you need at IDNLearn.com. Thanks for stopping by, and come back soon for more valuable insights.