Programming Exercise 4

  < Previous  Next >

Due Date

See the calendar for due date.

Assignment:

The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color. Design a program that prompts the user to enter the names of two primary colors, one at a time. If the user enters anything other than "blue," "red," or "yellow," the program should print "You did not input two primary colors." Otherwise, it should print something in the format:
When you mix blue and red, you make purple.
When you mix blue and yellow, you make green.
When you mix red and yellow, you make orange.

Examples

The following are examples of correct execution (with the text in bold being the input from the user):
Please enter a primary color: red
Please enter a primary color: yellow
      
When you mix red and yellow you make orange
Please enter a primary color: blue
Please enter a primary color: red
      
When you mix blue and red you make purple
Please enter a primary color: cyan
Please enter a primary color: fuchsia
      
You typed cyan which is not a primary color!
After completing the program and testing the output for accuracy, make sure that you have a comment lines at the top of your file with your name, course and section, current date, and assignment description.

Submission

Submit your python script using the handin program. For handin, for this lab, type the following in a terminal window exactly as it appears:
handin  pe4  pe4.py
To verify your submission, type the following in a terminal window:
handin  pe4