Explore Westonci.ca, the leading Q&A site where experts provide accurate and helpful answers to all your questions. Explore thousands of questions and answers from a knowledgeable community of experts on our user-friendly platform. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.
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()
Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Westonci.ca is committed to providing accurate answers. Come back soon for more trustworthy information.