Jun-04-2020, 12:08 PM
Ding, ding, ding! I pulled it off, thanks to @bowlofred's advice.
I replaced the second and third instances of the
For what it is worth, here is my final script in full:
I meant to reply sooner. Sorry for the delay.
I replaced the second and third instances of the
break
operator with continue
. I also removed the second and third instances of print("bye")
. When I ran the test script, it passes all 5 checks. For what it is worth, here is my final script in full:
VALID_COLORS = ['blue', 'yellow', 'red'] def print_colors(): """ In the while loop ask the user to enter a color, lowercase it and store it in a variable. Next check: - if 'quit' was entered for color, print 'bye' and break. - if the color is not in VALID_COLORS, print 'Not a valid color' and continue. - otherwise print the color in lower case. """ while True: chosen_color = input("What color do you choose?") low_chosen_color = chosen_color.lower() if low_chosen_color == "quit": print("bye") break elif low_chosen_color not in VALID_COLORS: print("Not a valid color") continue elif low_chosen_color in VALID_COLORS: print(f"{low_chosen_color}") continue passThanks @bowlofred for your help.
I meant to reply sooner. Sorry for the delay.