First I wanna ask the user to enter the weight, then I wanna ask them if their input value is in kg or lbs. If they enter the weight in kg, I wanna output their weight in lbs and vice versa.
weight = input('Enter your weight: ')
unite = input('In kg(k) or lbs(l)? ')
k = 2.2046/float(weight)
l = 0.453592*float(weight)
if weight and k:
print(l ,'lbs')
elif weight and l:
print(k ,'kg')
Heres what I did. Can someone explain why its always showing "lbs" with the output value? Can't seem to get it to show "kg" when I initially choose (l), but the conversion is fine
Aucun commentaire:
Enregistrer un commentaire