Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: To practice a simple loop and simple conditionals Degree of Difficulty: Easy For this question, you'll write a simple program that makes the user

image text in transcribed
Purpose: To practice a simple loop and simple conditionals Degree of Difficulty: Easy For this question, you'll write a simple program that makes the user try to guess a secret number repeatedly until they get it right First, your program should select a random number between 1 and 10. You can use the randint() method from the random module to do this. This is the secret number that the user is trying to guess. Then, your program should allow the user to input numbers as many times as needed in order to guess the secret number. If the user gets it wrong, the program should give a hint by telling the user whether their guess was too high or too low. If the user gets it right, the program should tell them so and then terminate. Sample Run Sample input and output (input typed by the user is shown in green text): Guess a number from 1 to 1015 Too lou! Guess again: 7 You got it, the secret number wa What to Hand In A file called a3q1.py containing your finished program, as described above. alled a3q1.py containing Evaluation 1 mark. The random module is correctly used to get a secret number 2 marks: A loop is used to allow repeated input when the guess is incorrect 1 mark Conditionals are used to give an appropriate hint when the guess is incorrect

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions