+ 1
Invalid elif syntax error
import string a = input() c = input() if str(c) == "lb": b = float(a) // float(0.454) print(str(b) + " kg") elif str(c) == "kg": b = float(a) * float(2.204) print (str(b) + " lb") does any body know why this is giving me an error
1 Odpowiedź
+ 1
Because the indentation is very important in Python.
Working code:
a = input()
c = input()
if str(c) == "lb":
b = float(a) // float(0.454)
print(str(b) + " kg")
elif str(c) == "kg":
b = float(a) * float(2.204)
print (str(b) + " lb")