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")
4 Answers
+ 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.
+ 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?
+ 1
No but I get often when writing code Lothar
Btw thanks for help buddy.