Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Color mixing
#8
This question has nothing to do with hex codes. It has nothing to do with color mixing. The assignment is about input verification and logic.

Your program needs to print instructions to the user and take user input. You've demonstrated you know how to print instructions. Do you know how to take user input?

Once you get user input you may need to process it to derive a result to print. Looks like you intend to do something like this:
If the two primary colors are red and blue
    print purple
else if the two primary colors are blue and yellow
    print green
else if the two primary colors are red and yellow
    print orange
else
    print error message
How do you convert this pseudo code into Python? "two primary colors" sounds like a container that can hold multiple values. Which Python types can contain more than one value?

How do you do the comparison? Are red and blue going to be the strings "red" and "blue"? What if the user types "Red" and "BLUE"? Those should be identified as primary colors. How can you make the string comparison case insensitive?

What should you do if the user enters "blue" and "blue"? These are both primary colors, and if you mix them you get blue. Should your program print "blue" or should it warn that the colors cannot be the same?
Reply


Messages In This Thread
Color mixing - by thyva - Jan-27-2017, 01:34 AM
RE: Color mixing - by micseydel - Jan-27-2017, 02:05 AM
RE: Color mixing - by thyva - Jan-27-2017, 02:38 AM
RE: Color mixing - by Mekire - Jan-27-2017, 02:44 AM
RE: Color mixing - by thyva - Jan-27-2017, 02:54 AM
RE: Color mixing - by sparkz_alot - Jan-27-2017, 03:56 PM
RE: Color mixing - by Thadectives - Jun-09-2022, 11:24 AM
RE: Color mixing - by deanhystad - Jun-09-2022, 02:36 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020