Answered step by step
Verified Expert Solution
Question
1 Approved Answer
9.10 Python Assignment: Guess a Number You will create a program that selects a number from 1 to 100. The user will guess the number,
9.10 Python Assignment: Guess a Number You will create a program that selects a number from 1 to 100. The user will guess the number, - Select a random integer in the range [1,100] write the following at the top of your code import randon random.seed (300) Note: The line random. seed (300) will lock your random into a specific number each time it runs . Use number-random.randint (1, 100) to generate your random number Tell the user that a number between 1 and 100 has been chosen While the selected number has not been guessed. Prompt user to enter a guess Compare guess to selected number Print 'too high', too low.' or 'you got it!" Print the number of guesses the user took to guess the number Sample input/output: .Note: Be sure to match every character, including punctuation. If the tester throws an error that says: EOF Error: EOF when reading a line, that means your code is looping longer than it should. A number between 1 and 100 has been chosen Take a guess: 50 Your guess is too LON Take a guess: 75 Your guess is too LOW Take a guess: 87 Your guess is too HIGH Take a guess: 81 Your guess is too HIGH Take a guess: 78 Your guess is too HIGH Take a guess: 76 Your guess is too LoW Take a guess: 77 You got it! It took you 7 guesses
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started