Title | 4-3 assignment module four flowchart |
---|---|
Author | Meya Abe |
Course | Introduction to Scripting |
Institution | Southern New Hampshire University |
Pages | 3 |
File Size | 132.8 KB |
File Type | |
Total Downloads | 30 |
Total Views | 145 |
flowchart...
4-3 Assignment: pseudocode Revisited Shemshia Abdella
Module four flowchart
#Write pseudocode for a higher/lower program that includes input and output, decision branching, and a loop. Using pseudocode, write the different steps needed in a higher/lower program. The pseudocode should prompt the user to input the lower bound and upper bound. Generate a random number between the lower and upper bounds. Prompt the user to input a guess between the lower and upper bounds. Print an output statement based on the guessed number. Create a loop so that the program continues to prompt the user for a new input until the user guess the random number generated by the program. #1-29-2021 Pseudocode for Higher/Lower Game START IMPORT random function, so that a random number can be generated by the program READ random. Seed variable INPUT prompt user for an integer value for seedVal in order to ‘seed’ the random number generator INPUT integer for lower and upper bounds variables READ lower, upper IF lower bound is higher than the upper bound THEN: INPUT variable integers again ELSE assign correct_num variable READ correct_num variable as the random number generated between ranges of the upper and lower bound While TRUE guess loop INPUT prompt user to guess an integer OUTPUT ‘What is your guess?’ READ user guess variable IF user_guess is lower than correct guess THEN OUTPUT ‘Nope, too low.’ IF user_guess is higher than correct_num
4-3 Assignment: pseudocode Revisited Shemshia Abdella
THEN OUTPUT ‘Nope, too high.’ IF user_guess is equal to correct_num THEN OUTPUT ‘You got it!’ STOP
Module four flowchart
4-3 Assignment: pseudocode Revisited Shemshia Abdella
Module four flowchart
Start
Import random function
INPUT integer for seedVAL
Assign seedVAL to random.seed variable
INPUT integers for variables: lower FALSE and upper
Assign the correct_num variable with the randint variable within the range of the lower and upper bounds
If lower is higher than upper
INPUT user variable READ user_guess to store the integer the user has guessed
TRUE user_guess = correct_num
STOP
FALSE
FALSE
If user_guess is too high, guess again
If user_guess is too low, guess again...