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
Get step-by-step solutions from verified subject matter experts
