+ 2
Om Deshmukh , in your conditional checks red and green you place as names of variables instead of strings . Also to compare use '==' instead of assignment '='. Look at the code.
https://code.sololearn.com/c4S5EeXVK8wP/?ref=app
+ 1
https://code.sololearn.com/cnkHQK4D0cKg/?ref=app
+ 1
Hi,
color = input()
if color == âredâ:
print(1)
elif color == âgreenâ:
print(2)
elif color == âblackâ:
print(3)
please use â==â for equality.
and color == âredâ because you wanna make sure if your input color is red.
At the end use elif instead of else, because you wanna print(3) only if the color is black. If you use else, beside you will print for all colors 3 except red and green colors.