samedi 3 mars 2018

How do I get rid of all these if statements?

If statements

if price == "900" and money >= "900":
    print ("yes")
elif price == "1200" and money >= "1200":
    print ("yes")
elif price == "1500" and money >= "1500":
    print ("yes")
elif price == "2200" and money >= "2200":
    print ("yes")


if price == "900" and money <= "900":
    print ("No")
elif price == "1200" and money <= "1200":
    print ("No")
elif price == "1500" and money <= "1500":
    print ("No")
elif price == "2200" and money <= "2200":
    print ("No")

Aucun commentaire:

Enregistrer un commentaire