Computer Science, asked by ali804063, 3 months ago

write a python program Assume d1 and d2 have the numbers on 2 dice. Accept d1 and d2 as input. First, check to see that they are in the proper range for dice. If not, print a message. Otherwise, determine the outcome. If the sum is 7 or 11, print winner. If the sum is 2, 3 or 12, print loser. Otherwise print the points.​

Answers

Answered by Equestriadash
5

The following co‎des have been written using Python.

#obtaining input

d1 = int(input("Enter a number: "))

d2 = int(input("Enter a second number: "))

#testing for the range

if d1 <= 6 and d2 <= 6:

   #testing the sum

   if d1 + d2 == 7 or d1 + d2  == 11:

       print("Winner!")

   elif d1 + d2 == 2 or d1 + d2 == 3 or d1 + d2 == 12:

       print("Loser!")

   else:

       print("You get", d1 + d2, "points!")

else:

   print("The numbers are out of the dice range.")

Similar questions