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")
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
0
that didnât run :/ I also need to allow for both lower and upper case inputs
0
yeah, sorry. noticed your edit, but Iâm not getting it. Only started coding yesterday