dimanche 22 novembre 2020

Why or breaks this code and doesn't show an error [duplicate]

I tried to put or in this exercise so that it could accept both lower case and upper case, I had forgotten about .upper, but I've been wondering why does or makes so the code won't work properly?

weight = input("Weight: ")
weight = int(weight)
variable = input("(L)bs or (K)g: ")

if variable == "L" or "l":
    print(f"You are {weight * 0.45} Kilos")

elif variable == "K" or "k":
    print(f"You are {weight * 2.205} Pounds")

Aucun commentaire:

Enregistrer un commentaire