I'm new to Python and trying to create a weight converter by using if
, else
statements.
This should ask the user to input weight and unit in pounds (lbs) or kilograms (kgs) and convert it, but the program is only executing the if
condition.
Here is the snippet of my code:
weight = int(input("Weight = "))
unit = input('(L)bs or (K)')
if unit == "L" or "l":
print(f'You are {weight*0.45} kilograms')
elif unit == "K" or "k":
print(f'You are {weight*2.2} pounds')
else:
print('The converter is only for Kgs and Lbs')
Here is a screenshot: