+ 3

Why this gives me syntax error?

print("||Wellcome To Python||") str = input("Weight and Hieght") a,b = str.split(' ') print('Your BMI is',int(a) / ((int(b))**2)) int(a) = int(a) / (int(b)**2 if (a > 25) print("Fat!") elif (a > 20 & a < 25) print("Good!") elif (a < 20) print("Thin!") input("Press Space to finish...")

13th Oct 2017, 9:02 AM
amirali82
amirali82 - avatar
2 Réponses
+ 1
If statements in python don't require parentheses, but do require a colon after the statement declaration: if a > 25 : print("Fat")
13th Oct 2017, 10:14 PM
Nic
+ 3
thank you very much!
14th Oct 2017, 4:10 PM
amirali82
amirali82 - avatar