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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started