jeudi 29 septembre 2016

How can i simplify this condition in python?

Do you know a simpler way to achieve the same result as this?: I have this code:

color1 = input("Color 1: ")
color2 = input("Color 2: ")

if ((color1=="blue" and color2=="yellow") or (color1=="yellow" and color2=="blue")):
            print("{0} + {1} = Green".format(color1, color2))

I also tried with this:

if (color1 + color2 =="blueyellow" or color1 + color2 =="yellowblue")

Aucun commentaire:

Enregistrer un commentaire