Python Forum

Full Version: why does this if-statement not work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I am the biggest noob in this forum probably, so my first question is why this simple if-statement allways
accepts the first if-statement regardless of what i put in to the 'unit' variable?

weight = float(input(f'Weight: '))
unit = input('[L]bs or [K]g: ').lower()


if unit == 'k' or 'kg':
    print(f'weight is {weight / 0.45} pounds')
elif unit == 'l' or 'lbs':
    print(f'weight is {weight * 0.45} kg')
else:
    print('Invalid unit of measurement')
thx
(Nov-15-2019, 03:07 PM)buran Wrote: [ -> ]https://python-forum.io/Thread-Multiple-...or-keyword
Thank you, that explained it well!