Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions