Python Forum
Using 'Or' Operator with If loop - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Using 'Or' Operator with If loop (/thread-30941.html)



Using 'Or' Operator with If loop - zulqarnainbokh1995 - Nov-14-2020

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.?


RE: Using 'Or' Operator with If loop - buran - Nov-14-2020

https://python-forum.io/Thread-Multiple-expressions-with-or-keyword