In: Computer Science
Draw a structured flowchart or write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have someone try to guess it by following your instructions. Submit the flowchart or pseudocode and the results of your test. Create a python program based on your flowchart or pseudocode. The language is python
GIVEN THAT:
Draw a structured flowchart or write pseudocode.
To describes the process of guessing a number between 1 and 100.
pseudocode
(i) Generate a random number between 1-100 store value in num of integer type
(ii) define a flag match and initialize to False
(iii) Initiate a loop until match is found
(iv) Within loop
(v) prompt user to guess a number
(a) if guess == num
print winning message
and set flag to true
(b) if guess > num
print too high message
(c) if guess < num
print too low message
(vi) end the program
"""
import random
# generate number between 1 -100
num = random.randint(1, 100)
match = False
while not match:
guessNumber = int(input("Guess a number: "))
if guessNumber == num:
print("Hurray!!! You found the number.")
match = True
elif guessNumber > num:
print("guess is too high.")
else:
print("guess is too low.")