BRITTANY F.

asked • 02/27/22

what statements do I use so my code knows red, RED, Red, rEd, or regardless of any capitalized/lowercase letter the program knows what red is are the same?

what statements do I use so my code knows red, RED, Red, rEd, or regardless of any capitalized letter the program knows what red is are the same?



print("Menu of Colors, Blue, Red, Yellow")


first_color = input("pick first color:")

second_color = input("pick second color:")


if(first_color.lower() ==("red").lower())

if(first_color.upper() ==("red").upper())



if (first_color == "red" and second_color == "yellow") or (first_color == "yellow" and second_color == "red"):

print("orange")

elif (first_color == "blue" and second_color == "red") or (first_color == "red" and second_color == "yellow"):

print("purple")

elif (first_color == "blue" and second_color == "yellow") or (first_color == "yellow" and second_color == "blue"):

print("green")

else:

print("invalid color")

1 Expert Answer

By:

William A. answered • 02/28/22

Tutor
5 (1)

Tutor for Computer Science and Mathematics

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.