Create a Python program

For this assignment, you will create a Python program that will accept user input of an English color value from a given range of colors and will return the Spanish equivalent. You will use IF, ELIF, and ELSE statements along with comparison operators to evaluate the entered value and display the appropriate results to the user.

Assignment Instructions

  1. Print a string statement with a list of acceptable colors to the screen:

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

    Reference: Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 2: Print Statements.

  2. Prompt the user to enter a color value from the list. Assign the user input to a variable (i.e., userColor).

    “Enter a color from the list above: ”

    Reference: Refer back to your Unit 1 readings in Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 3: Built-In Functions / Getting Input From the User.

  3. Convert the color value entered to all lowercase for easier evaluation. Use the string function lower and store the lowercase color in a new variable (i.e., color).

    Reference: Refer back to your Unit 1 readings in Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 8: Built-In String Operations.

  4. Create a variable named validColor and set it to a value of true.
  5. Using a series of IF/ELIF statements, evaluate the color and set a new variable (i.e., spanishColor) to the appropriate Spanish equivalent. Use a final else statement if a valid color was not entered, and assign the validColor flag to a value of false.

    red = rojo

    blue = azul

    green = verde

    white = blanco

    yellow = amarillo

    Reference: Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 5: The if Statement / Comparison Operators / The elif Statement / Using Many elif Statements.

  6. Create a final IF/ELSE statement to evaluate the validColor flag. If a valid color was entered, use string concatenation to display the English color (color) and its Spanish equivalent (spanishColor). If not, display a message indicating a valid color was not entered.

    Reference: Refer back to your Unit 1 readings in Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 2: Print Statements; Chapter 3: Built-In Functions / Concatenation.

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!