I am making this converter that converts your weight from kg to lbs and vice versa. It first allows you to input weight then asks if its in kg or lbs then gives you the result. The code is given below.
weight = int(input("What is your weight? "))
unit = input ("(L)bs or (K)g? ")
unit = unit.upper
if unit == "L":
converted = (weight * 0.45)
print(converted)
else:
converted = (weight // 0.45)
print(converted)
The converter is working fine if I put my kg and say its kg. but when I put my weight in lbs and say it is in lbs, it assumes the value is in kg and gives me the answer in lbs. can anyone tell me what seems to be the issue here
Aucun commentaire:
Enregistrer un commentaire