subject
Computers and Technology, 01.11.2019 02:31 Bubba06

Write a program that plays a guessing game with the user. specifically, your program should randomly pick a number between 1 and 100. then, ask the user for a guess. you should detect and tell the user if the guess is not a valid guess. otherwise, tell the user their guess was too high or too low. the program should continue to prompt the user for new guesses until they get the correct number, telling them each time if the guess was too high or too low or invalid.

you have been supplied code to pick a random number between 1 and 100 each time you run your program. here are a couple development/debugging strategies for this "target" variable:

print out the random number, to make sure your program is acting correctly – remember to remove/comment this before running unit tests/submitting.

temporarily set the random "seed" to a value, which will have the effect of always choosing the same random number – the unit tests have fixed seeds that you can use with known outcomes.

temporarily set the "target" variable to a fixed number, so you can test to see how your program responds in different testing situations.

here’s a sample run of a working version of the program:

enter your guess (between 1 and 100): 50

too high!

enter your guess (between 1 and 100): 0

invalid guess, try again!

enter your guess (between 1 and 100): 101

invalid guess, try again!

enter your guess (between 1 and 100): 25

too high!

enter your guess (between 1 and 100): 12

too high!

enter your guess (between 1 and 100): 6

too high!

enter your guess (between 1 and 100): 3

too low!

enter your guess (between 1 and 100): 4

too low!

enter your guess (between 1 and 100): 5

you win!

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:50
Can online classes such as gradpoint track your ip location like if im taking a final and i give somebody else my account and they take the final for me will it show where they are taking the final from? and can this be countered with a vpn
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
You know the right answer?
Write a program that plays a guessing game with the user. specifically, your program should randomly...
Questions
question
Mathematics, 31.10.2020 04:20
question
Mathematics, 31.10.2020 04:20
question
Mathematics, 31.10.2020 04:20
question
Spanish, 31.10.2020 04:20
Questions on the website: 13722367