Home / Expert Answers / Computer Science / in-python-using-this-pseudocode-write-a-program-nbsp-that-plays-the-hi-lo-game-with-numbers-the-p-pa656

(Solved): *IN PYTHON* Using this pseudocode write a program that plays the Hi-Lo game with numbers. The p ...



*IN PYTHON* Using this pseudocode write a program that plays the Hi-Lo game with numbers. The program should pick a random integer from 1 to 100 and then repeatedly prompt the user to guess the number. On each guess, report to the user that he or she is correct or that the guess is high or low. Continue accepting guesses until the user guesses correctly or chooses to quit (by entering the sentinel value of 0, which should be a defined constant). At the end of the program, the program prints the random number and an appropriate message (e.g, that the guess was correct or that the user chose to quit). 

Your program is required to validate the user’s input. Your program should also use two defined constants: one for the sentinel value and one for the maximum value of 100. (Next week we might want to play the game with a different upper bound. For example, we might use an upper bound of 10 or 20 for younger children.)

Print instructions

random_num = a random integer in the range 1 to 100

Input guess

while (guess is wrong and user has not chosen to quit)

      if (guess is too low)

            print appropriate too low message

else

      print appropriate too high message

Input guess

if (guess is correct)

     print an appropriate message, including random_num

else

      print an appropriate message, including random_num



We have an Answer from Expert

View Expert Answer

Expert Answer


*Relevant comments are there for better understanding* Here you go: main.py from random import randint # sentinel constant SENTINEL = 0 # max value co
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe