Skip to content

Instantly share code, notes, and snippets.

@gitaficionado
Created March 11, 2021 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitaficionado/deebcd0f872dc1dad3137daaf091a0e0 to your computer and use it in GitHub Desktop.
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.
'''
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.")
@Githubiton
Copy link

is this in python?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment