Question
Write a python program, where the computer randomly selects a number between 1 and 100. The user is then asked to guess the number. Once
Write a python program, where the computer randomly selects a number between 1 and 100. The user is then asked to guess the number. Once the user enters a number, the computer will respond with higher or lower if the users guess is higher or lower than the computers number. The number of guesses allowed are limited to 7. If the user guesses the number within 7 tries then print out a congratulatory message Congratulations! You have guessed the right number and end the program. If the user is unable to guess the number before their turns are finished, then print out a message telling the user Unfortunately! You have failed. The correct number was and then ask the user if he wants to play again. If the user says no, end the program.
Define new functions and call them/use them in the code
Use of control flow (conditional statements).
Use of repetitional statements (for or while loop)
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