Computers and Technology

Must be python format Create a program which will choose a random number between 1 and 1000.
Ask the user to guess at the number, and give the user feedback if their guess is too high or too low.
Also, keep track of the number of guesses that the user makes.
"Redirect" the user if they enter a number outside of the range of 1 to 1000, and the error should not count as one of their guesses.
When the user finally guesses the answer, congratulate them and inform them how many guesses it took them to arrive at the correct number. (and the program should end)
Much of this will be done using the WHILE command, and perhaps an IF statement.

(sample output of the program is below)

Guess a number between 1 and 1000? 500
Your guess is too low! Try a higher number.

Guess a number between 1 and 1000? 2000

Whoops, guess a number between 1 and 1000? 750
Your guess is too high! Try a lower number.

Guess a number between 1 and 1000? 625
Your guess is too high! Try a lower number.

Guess a number between 1 and 1000? 560
Your guess is too high! Try a lower number.

Guess a number between 1 and 1000? 530
Your guess is too high! Try a lower number.

Guess a number between 1 and 1000? 515
Your guess is too low! Try a higher number.

Guess a number between 1 and 1000? 520

Your guess is too high! Try a lower number.

Guess a number between 1 and 1000? 517

Your guess is too low! Try a higher number.

Guess a number between 1 and 1000? 518

You got it! The number is 518 and you got it in 9 guesses!

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:10, reycaden
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
image
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, lilobekker5219
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
image
Computers and Technology, 23.06.2019 03:00, SKYBLUE1015
What are the different parts of computer
Answers: 2
Do you know the correct answer?
Must be python format Create a program which will choose a random number between 1 and 1000.
...

Questions in other subjects:

Konu
Mathematics, 24.08.2020 22:01