Help with - IMP test problem in python. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Help with - IMP test problem in python.

Help with - IMP test problem in python. The code works in:  PyCharm, but doesn't work in sololearn, Error : "Line 12 (invalid character in identifie" My cod: # I M T #weight a = int(input("Please enter weight:")) #height b = float(input("Please enter height:")) #formul int = a/(b**2) print("рассчёт коф. веса : " + str(int)) #tested if int < 18.5:     print("Normal") elif int > 18.5 and int <=25:     print("Underweight") elif int >= 25 or int <= 30:     print("Overweight") else:     print("Obesity")

29th Aug 2022, 5:18 PM
Valmak
Valmak - avatar
3 Antworten
+ 4
Valmak , the issue of your code is the appearance of some (13) unicode character \xa0 => NO-BREAK SPACE. i have converted the code, so you can try it without re-typing it: another hint: these conditions looks like they are mixed up: (check all conditions if they are ok) if int < 18.5: print("Normal") elif int > 18.5 and int <=25: print("Underweight") https://code.sololearn.com/cvZkux5bLHWY/?ref=app
29th Aug 2022, 6:23 PM
Lothar
Lothar - avatar
+ 1
#your code goes here weight = int(input()) height = float(input()) BMI = weight/height**2 if BMI < 18.5: print("Underweight") elif BMI >= 18.5 and BMI < 25: print("Normal") elif BMI >= 25 and BMI < 30: print("Overweight") elif BMI >= 30: print("Obesity") https://code.sololearn.com/cDQGCYxXqk25/?ref=app
29th Aug 2022, 5:21 PM
Sreeju
Sreeju - avatar
+ 1
It's in the error. When you copy and paste code, you may be copying invisible characters. In each print statement line there are invisible characters. Rewrite it, or delete the characters
29th Aug 2022, 5:24 PM
Slick
Slick - avatar