-
Notifications
You must be signed in to change notification settings - Fork 1
Assignment: I Am Thinking of a Number...Line By Line Walkthrough
###Line By Line Walkthrough
Create a variable that will keep track if the game is over or not and set it to a boolean value (either True or False). This will be used in Line 2 to either keep the game going or end the game.
Use the while keyword, the variable you created above, and a colon to start the while statement. You may or may not want to use the not keyword to negate your variable from Line 1.
Create a variable that will store the guess prompted by the input() command. In the input() command, include text to ask a user for a number.
Use the int() command to turn the guess from text into a integer. And then store that integer into the variable you created in Line 3.
Use the if keyword, your guess variable, the less than operator, the correct number, and a colon to start the if statement.
Use an indent and a print() command to let the user know the guess was too low.
Use the elif keyword, your guess variable, the greater than operator, the correct number, and a colon to start the elif statement
Use an indent and a print() command to let the user know the guess was too high.
Use the else keyword and a colon to start the else statement
Use an indent and a print() command to let the user know the guess was correct.
Use an indent and your variable from Line 1 to end the game.