0

Weight converter problem

In the following code, no matter whether I input L for (L)bs or K for (K)g, I always get the conversion into kilos. Can anyone tell me what i’m doing wrong? weight = int(input("Weight ")) system = input("(L)bs or (K)g: ") if system == "l" or "L": converted_weight_lb = (weight) / 0.45 print(f"You are {converted_weight_lb} kilos") else: converted_weight_kg = (weight) * 0.45 print(f"You are {converted_weight_kg} pounds")

9th Jan 2020, 1:02 AM
laurence astley
3 RĂ©ponses
+ 1
You can use `in` operator too if system in "Ll": # codes for LBS here elif system in "Kk": # codes for KG here
9th Jan 2020, 3:30 AM
Ipang
0
that didn’t run :/ I also need to allow for both lower and upper case inputs
9th Jan 2020, 1:18 AM
laurence astley
0
yeah, sorry. noticed your edit, but I’m not getting it. Only started coding yesterday
9th Jan 2020, 1:27 AM
laurence astley