+ 1

What happened with my code?

I created a BMI calculator, with weight and height, but it always gives a syntax error peso: input('Insert your heigth:') altura : input('Insert your weight:') imc : altura/(peso*peso)   if imc==17 and imc<=18.49:    print('Low weight')   elif imc==18.50 and imc<=24.99:    print('Normal weigth')   elif imc==25 and imc<=29.99:    print('Overweight')   elif imc==30 and imc<=34.99:    print('Obesity grade I')   elif imc==35 and imc<=39.99:    print('Obesity grade II')   elif imc=>40:    print('Obesity grade III (morbid obesity)')

22nd Jan 2021, 2:39 PM
Iolanda Gabrieli
Iolanda Gabrieli - avatar
3 odpowiedzi
+ 5
Iolanda Gabrieli , there are also some other issues in the code: ▪︎the "spaces" before each print statement contains "invalid characters" (probably caused by copy and paste) ▪︎the last elif statement is using a wrong comparison operator -> should be ">=" maybe it is also a good idea to mention what measures your code is using: cm, m, inch, kg, pounds or whatever
22nd Jan 2021, 3:13 PM
Lothar
Lothar - avatar
+ 1
You got a syntax error here: Peso = input('Insert your height:') And in all inputs.
22nd Jan 2021, 2:59 PM
David Delgado
David Delgado - avatar
+ 1
Thanks
22nd Jan 2021, 3:01 PM
Iolanda Gabrieli
Iolanda Gabrieli - avatar