-4

I made this code to give back user input in different colors. The user should be able to type what they want and choose the color they want.

When I run the code, it works only if I type the colors in correctly. The if statement for the colors isn't working.

This is the code:

from termcolor import colored

while True:
    try:
        Colors = ['grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
        print("Colors = grey, red, green, yellow, blue, magenta, cyan, white")
        if input("Enter a Color: ") != Colors:
             print("Not a Valid Color ")
        elif input("Enter a Color: ") == Colors:
             print(colored(input("Type Something: "), input("Enter a Color: ")))
        else:
             continue
    except ValueError:
        print("Not a Valid Color")
BoarGules
  • 15,507
  • 2
  • 28
  • 42
  • 1
    Do you know what `while print(something):` means? – Mechanic Pig May 15 '22 at 16:28
  • 2
    I'm sorry, but there are a lot of basic programming issues that are going wrong in your code. Stack Overflow is not going to be the right place to help you with this. Is there a teacher or fellow student nearby that you can ask to help with this? If not, you may want to find a forum like Reddit, instead, as you'll need a lot more back-and-forth to sort out all the issues. We can't do that here. – Martijn Pieters May 15 '22 at 16:30

0 Answers0