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 20:00
Which type of file can be used to import data into a spreadsheet?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Visually impaired individuals generally rely on the for navigation. thus, designers need to ensure that mouse-specific inputs, such as pointing, clicking, and hovering, can be done without a mouse.
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
The output voltage of a power supply is assumed to be normally distributed. sixteen observations are taken at random on voltage are as follows: 10.35, 9.30, 10.00, 9.96, 11.65, 12.00, 11.25, 9.58, 11.54, 9.95, 10.28, 8.37, 10.44, 9.25, 9.38, and 10.85
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, 26.08.2019 17:30
question
Mathematics, 26.08.2019 17:30
Questions on the website: 13722363