Advertisement
nuggetin

colormix

Nov 3rd, 2021
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. print("Color mixer!")
  2. pclist = ["RED", "BLUE", "YELLOW"]
  3.  
  4. def inputColor():
  5.     check = False
  6.     while not check:
  7.        pc = input("Insert Primary Color 1 (Red, Blue, Yellow): ").upper()
  8.        check = any(pc in s for s in pclist)
  9.        if not check:
  10.          print("RED, BLUE, YELLOW only.")
  11.     check = False
  12.     while not check:
  13.        pc2 = input("Insert Primary Color 2 (Red, Blue, Yellow): ").upper()
  14.        check = any(pc2 in s for s in pclist)
  15.        if not check:
  16.          print("RED, BLUE, YELLOW only.")
  17.     mix(pc, pc2)
  18.  
  19. def mix(pc, pc2):
  20.     if (pc == "RED" and pc2 == "YELLOW") or (pc == "YELLOW" and pc2 == "RED"):
  21.       print("\nThe combination of the 2 primary color is ORANGE.")
  22.  
  23.     elif (pc == "RED" and pc2 == "BLUE") or (pc == "BLUE" and pc2 == "RED"):
  24.       print("\nThe combination of the 2 primary color is PURPLE.")
  25.  
  26.     elif (pc == "YELLOW" and pc2 == "BLUE") or (pc == "BLUE" and pc2 == "YELLOW"):
  27.       print("\nThe combination of the 2 primary color is VIOLET.")
  28.  
  29.     else:
  30.       print("error")
  31.  
  32. def mixAgain():
  33.     yn = input("\nMix another? Y/N: ").upper()
  34.  
  35.     if yn == "Y":
  36.         return True
  37.     else:
  38.         return False
  39.  
  40. inputColor()
  41. while mixAgain():
  42.  inputColor()
  43. print("Thanks for using me!")
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement