Code:
You will then modify it to ask the user for a color. You will ask them again and again until they guess “red” OR they have run out of guesses, i.e. they have guessed the wrong color 4 times.
You will then give them some feedback.
Note: you will need to use at most one loop and one condition to get full credit.
Code:
Example 1:
What is your name? Jordan
What color do you guess? White
let’s try again: What color do you guess? red
“Congratulations! You guessed the correct color in 2 tries.”
Example 2:
What is your name? Jordan
What color do you guess? White
let’s try again: What color do you guess? Blue
let’s try again: What color do you guess? Green
let’s try again: What color do you guess? Yellow
let’s try again: What color do you guess? Violet
“Jordan, you ran out of guesses, sorry!”