Question: Describe your program here. You must describe your program 3 . Write a Python program that asks the user to enter a number between 1
Describe your program here. You must describe your program
Write a Python program that asks the user to enter a number between and inclusive.
Make sure the number entered by the user is in the given range. If the userentered number is not in the range,
display an appropriate message to the user and repeatedly ask the user to enter a number in the range.
If the number is in the range but not equal to a computergenerated random number, assist the user by telling them
to guess higher or lower three times including the first attempt.
If the user did not win on the third attempt, display a message based on the following criteria.
random number user number; they win $ in lottery.
random number user number ; they win $ in lottery.
random number user number ; they win $ in lottery.
random number user number ; they win $ in lottery.
random number user number ; they win $ in lottery.
random number user number ; You didn't win; please try again.
Allow the user to play again as much as they like.
Input:
Enter a number between and to win lottery: a
Output:
Your input is invalid.
Enter a number between and to win lottery:
Input:
Enter a number between and to win lottery:
Output:
You entered a number out of range.
Enter a number between and to win lottery:
Output:
You won amount in lottery.
Do you wish to play the game again? y or n:
or
Sorry, You did not win; please try again.
Do you wish to play the game again? y or n:
Use must use variables such as choice, usernumber, amount, randomnumber, etc.
Hint: You will need to validate the usernumber.
import random
import math
choice y
# Write your code below this line
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
