Write a Windows application that randomly generates a number from 0 through 100.
ID: 3626619 • Letter: W
Question
Write a Windows application that randomly generates a number from 0 through 100. Prompt the user to guess the number. Let the user know if the guess is too low, too high, or is the correct number. Give the user another chance to guess the number. The user keeps guessing until he gets it correctly.Explanation / Answer
the pseudo-code set LOW to 1 set HIGH to 42 display welcome message get user name display menu get choice while choice is not q if choice is i display instructions else if choice is p set number to random number between LOW and HIGH set guess to 0 set guesses to 0 while guess is not number get guess while guess HIGH display error message get guess increment guesses if guess > number display too high message else if guess >> ") choice = choice.upper() while choice != "Q": if choice == "I": print INSTRUCTIONS elif choice == "P": # start new game guess = 0 guesses = 0 number = randint(LOW, HIGH) # keep guessing until user gets it while guess != number: guess = input(PROMPT) while guess HIGH: print "Invalid guess." guess = input(PROMPT) guesses += 1 if guess > number: print "My number is lower." elif guess num2 ) { coutnum1; } else if ( num1Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.