Question: For Python 3 Write a Python program that generates a random number from 1 to 10, including 1 and 10. Prompt two users to guess

For Python 3

Write a Python program that generates a random number from 1 to 10, including 1 and 10. Prompt two users to guess the number. Identify which guess is closest. If both guesses are equally close, print something stating there are no winners. You will likely have to use abs() which calculates the absolute value of the argument. abs(5) = 5, abs(-5) = 5, abs(0) = 0. You can assume ideal input users will not type the same guess.

HINT: Print the random number before prompting the users so the program is easier to debug.

Sample Run:

User 1, enter a number between 1 and 10: 8

User 2, enter a number between 1 and 10: 9

User 1 guessed 8 which is closer to 3 than 9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!