Question: What would the code resemble if I wanted to achieve the following output in python? Your color choices are red, blue, green, white or yellow.

What would the code resemble if I wanted to achieve the following output in python?

Your color choices are red, blue, green, white or yellow.

Enter a color from the list above: rEd

The color red in Spanish is rojo

Your color choices are red, blue, green, white or yellow.

Enter a color from the list above: black

That is not a valid color for this program. Ese no es un color vlido.

So far I have the following code. For some reason it isn't working:

print ("Your color choices are red, blue, green, white or yellow.")

text = str(input("Enter a color from the list above:")).lower()

validColor =True

if color == "red":

print ("rojo")

elif color == "blue":

print("azule")

elif color == "green":

print("verde")

elif color == "white":

print("blano")

elif color == "yellow":

print("amarillo")

else:

ValidColor =False

print ("That is not a valid color for this program. Ese no es un color valido.")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!