0

My code is not working or taking input correctly!!

weight=int(input("weight: ")) unit.upper =input("(K)g or (L)ml") if unit.upper=="L" : convert =weight/1000 print(f"you are {convert} litre") else: convert ==weight*1000 print(f"you are {convert} kilos")

20th Jun 2019, 5:11 AM
Ankit Tiwari
Ankit Tiwari - avatar
4 Respostas
+ 5
here the revised code: weight=int(input("weight: ")) unit =input("(K)g or (L)ml").upper() if unit == "L" : convert =weight / 1000 print(f"you are {convert} litre") else: convert = weight * 1000 print(f"you are {convert} kilos") 2. line: upper has to be on the right side and needs to have brackets (). 3. line: upper is not needed here because it’s already upper from line 2.
20th Jun 2019, 5:48 AM
Lothar
Lothar - avatar
+ 3
Indentation has to be of same type (space or tab) all over the complete file. Do not mix both types. 4 space is the recommendation for each indent level. Do you have a problem wirh indent in current code?
20th Jun 2019, 3:08 PM
Lothar
Lothar - avatar
+ 1
Lothar how to solve indentation error in Python?
20th Jun 2019, 2:03 PM
Ankit Tiwari
Ankit Tiwari - avatar
+ 1
No but I get often when writing code Lothar Btw thanks for help buddy.
21st Jun 2019, 5:32 AM
Ankit Tiwari
Ankit Tiwari - avatar