Created
March 11, 2021 16:32
-
-
Save gitaficionado/deebcd0f872dc1dad3137daaf091a0e0 to your computer and use it in GitHub Desktop.
Prompt the user to guess your favorite color. Using a while loop, if the user didn't guess your favorite color [pick one for this activity] then tell them they are incorrect, then ask them again. Whenever they guess the color correctly, output that they are correct and how many guesses it took them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
2. Prompt the user to guess your favorite color. Using a while loop, if the user didn't guess your favorite color [pick one for this activity] then tell them they are incorrect, then ask them again. Whenever they guess the color correctly, output that they are correct and how many guesses it took them. | |
Create a variable and assign it the value of 1 | |
Prompt the user to guess your favorite color | |
While their guess is not equal to your favorite color | |
Tell them they are incorrect | |
Prompt them to guess again | |
Add one to the variable above | |
Output to the user, they were correct and how many attempts it took using the variable | |
''' | |
# Loop Problem 2 | |
guesses = ___ | |
color = input("What do you think my favorite color is? ") | |
_______ color != "Green": | |
print("That is incorrect.") | |
color = input("What do you think my favorite color is? ") | |
________ = ________ + 1 | |
print("You are correct, it took you " + str(_____) + " guesses.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is this in python?