Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Color mixer!")
- pclist = ["RED", "BLUE", "YELLOW"]
- def inputColor():
- check = False
- while not check:
- pc = input("Insert Primary Color 1 (Red, Blue, Yellow): ").upper()
- check = any(pc in s for s in pclist)
- if not check:
- print("RED, BLUE, YELLOW only.")
- check = False
- while not check:
- pc2 = input("Insert Primary Color 2 (Red, Blue, Yellow): ").upper()
- check = any(pc2 in s for s in pclist)
- if not check:
- print("RED, BLUE, YELLOW only.")
- mix(pc, pc2)
- def mix(pc, pc2):
- if (pc == "RED" and pc2 == "YELLOW") or (pc == "YELLOW" and pc2 == "RED"):
- print("\nThe combination of the 2 primary color is ORANGE.")
- elif (pc == "RED" and pc2 == "BLUE") or (pc == "BLUE" and pc2 == "RED"):
- print("\nThe combination of the 2 primary color is PURPLE.")
- elif (pc == "YELLOW" and pc2 == "BLUE") or (pc == "BLUE" and pc2 == "YELLOW"):
- print("\nThe combination of the 2 primary color is VIOLET.")
- else:
- print("error")
- def mixAgain():
- yn = input("\nMix another? Y/N: ").upper()
- if yn == "Y":
- return True
- else:
- return False
- inputColor()
- while mixAgain():
- inputColor()
- print("Thanks for using me!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement