Python Forum

Full Version: Using 'Or' Operator with If loop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
weight=input("Weight: ")
iweight=float(weight)
kg_lb=input("(L)bs or (K)g: ")
if kg_lb=='L' or  'l':
  iweight=0.4535*iweight
  print(f"You are {iweight} kilos")
elif kg_lb=='K' or 'k':
  iweight=2.2046 * iweight
  print(f"You are {iweight} pounds")
I am new to Python. This is a weight converter program. But the or statement is not working. Can someone please mention the problem with this code.?