You are on page 1of 2

Itziar Villafuerte

SHNU

IT 140

Pseudocode

#Start with a greeting

print(‘Welcome to the Higher Lower Game!\n’)

#Set parameters for the game

While:

lowest = int(input(‘Enter the lowest possible number: \n’))

highest = int(input(‘Enter the highest possible number: \n’))

if(lowest > highest):

print(‘The lowest number can’t be larger than the highest possible number.\n’)

Else:

break

#Generate a random number that meets the parameters that were just set and guide

the player to make a guess

import random

number = random.randint(lowest, highest)

print(‘Good job! Now guess a number between’, lowest, ‘and’, highest,‘.\n’)

#Set parameters and input/output for identifying correct and incorrect guesses

while True:

guess = int(input( ))
if number == guess:

print(‘You guessed the right number! Good job!\n’)

Break

if(number > guess):

print(‘Not quite! The number you guessed is too low.\n’)

guess = int(input(‘Would you like to guess again?: \n’))

Else:

print(‘Not quite! The number you guessed is too high.\n’)

guess = int(input(‘Would you like to guess again?: \n’))

You might also like