0
Good night. Who tells me what error this code has?
color = input() red = 1 green = 2 black = 3 if color == red: print (red) elif color == green: print (green) elif color == black: print (black) else: print ("another color") note: It won't let me print the assigned numbers in the colors. just print the string "another color"
2 Answers
+ 8
color is a string while other variables are integers. So, you can't compare like this.
Try using quotes to convert them to strings. "red", "green"...
+ 4
Simba wow!
Thanks.