0

i want to make a code to ask someone's weight value and then ask if its in lbs or kg. then i want to convert the weight into the opposite unit. i am confused about why i cant use the 'or' function/ operator in this code.

[why can't i use or functions here, why is it wrong] -->

weight= int(input("whats ur weight?"))

unit= input("lbs(l) or kg(k)?")
if unit == "L" or "l":
    print(int(weight *.45))
elif unit == "K" or "k":
    print(int(weight / .45))

(why is this correct)==>

weight = int(input("whats ur weight?"))

unit = input("lbs(l) or kg(k)?")
if unit.upper() == "L":
    print(int(weight * .45))
elif unit.upper() == "K":
    print(int(weight / .45))

0 Answers0