PYTHON
Overview:
In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for a higher/lower game. This will give you practice designing a more complex program and allow you to see more of the benefits that designing before coding can offer. The higher/lower game will combine different programming constructs that you have been learning about, such as input and output, decision branching, and a loop. Higher/Lower Game Description Your friend Maria has come to you and said that she has been playing the higher/lower game with her three-year-old daughter Bella. Maria tells Bella that she is thinking of a number between 1 and 10, and then Bella tries to guess the number. When Bella guesses a number, Maria tells her whether the number she is thinking of is higher or lower or if Bella guessed it. The game continues until Bella guesses the right number. As much as Maria likes playing the game with Bella, Bella is very excited to play the game all the time. Maria thought it would be great if you could create a program that allows Bella to play the game as much as she wants. Prompt For this assignment, you will be designing pseudocode for a higher/lower game program. The higher/lower game program uses similar constructs to the game you will design and develop in Projects One and Two. Review the Higher/Lower Game Sample Output for more detailed examples of this game. As you read, consider the following questions: What are the different steps needed in this program? How can you break them down in a way that a computer can understand? What information would you need from the user at each point (inputs)? What information would you output to the user at each point? When might it be a good idea to use “IF” and “IF ELSE” statements? When might it be a good idea to use loops? Create pseudocode that logically outlines each step of the game program so that it meets the following functionality: Prompts the user to input the lower bound and upper bound. Include input validation to ensure that the lower bound is less than the upper bound. Generates a random number between the lower and upper bounds Prompts the user to input a guess between the lower and upper bounds. Include input validation to ensure that the user only enters values between the lower and upper bound. Prints an output statement based on the guessed number. Be sure to account for each of the following situations through the use of decision branching: What should the computer output if the user guesses a number that is too low? What should the computer output if the user guesses a number that is too high? What should the computer output if the user guesses the right number? Loops so that the game continues prompting the user for a new number until the user guesses the correct number.
Solved 1 Answer
See More Answers for FREE
Enhance your learning with StudyX
Receive support from our dedicated community users and experts
See up to 20 answers per week for free
Experience reliable customer service
General GuidanceThe answer provided below has been developed in a clear step by step manner.Step: 1HELCO STUDENT! ME MB ANSWER HELPEDExplanation:Please refer to solution in this step.Answer:from random import randint print('Welcome to the higher/lower game, Bella!') while True: lowerBound = int(input('Enter the lower bound: ')) upperBound = int(input('Enter the upper bound: ')) if lowerBound < upperBound: break print('The lower bound must be less than the upper bound') print() guessNumber = randint(lowerBound, upperBound) print() userNumber = int(input('Great, now guess a number between {} and {} : '.format(lowerBound, upperBound))) while guessNumber != userNumber: if userNumber > guessNumber: print('Nope, too high') if userNumber < guessNumber: print('Nop, too low') print() userNumber = int(input('Guess another number: ')) print('You got it!')Code Screenshotfrom randon import randintprint('Wlelcome to the higher/lower game, Bella!')while True:LowerBound = int(input ('Enter the Lower bound: '))upperBound = int(input('Enter the upper bound: '))if lowerBound < upperBound:breakprint('The lower bound must be less than the upper bound')print()guessNumber = randint (lomerBound, upperBound)print()userNumber = int(input('Great, now guess a number between {} and {}: '. format(LowerBound, upperBound)))while guessiumer I= userNumber:if userkumber > guessNumber:print('Nope, too high')if userNumber & guessNumber:print('Nop, too low')print()userNumber = int(input('Guess another number: "))print("You got it!")Output welcome to the higher/lower game, Bella!Enter the lower bound: 10Enter the upper bound: 5The Lower bound aust be less than the upper boundEnter the lower bound: 1 \thetaEnter the upper bound: 2 \thetaGreat, now guess a number between 18 and 28: 15Nop, too lowGuess another number: 17Nop, too lowGuess another number: 19Nope, too highGuess another number: 18You got it!Process finished with exit code \theta ...