Error? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
- 1

Error?

Imc Python

24th May 2021, 8:26 AM
Carmen Chirinos
Carmen Chirinos - avatar
13 ответов
+ 5
peso = int(input()) altura = float(input()) imc = ( peso / altura ** (2)) if imc >= 30.0: print("Obesity") if imc >= 25.0 and imc <= 30: print("Overweight") if imc >= 18.5 and imc <= 25: print("Normal") if imc <= 18.4: print("Underweight")
24th May 2021, 8:42 AM
Simba
Simba - avatar
+ 2
Ok, tuve un dolor de cabeza.. por este ejercicio de 3 dias jajaja pero logré resolverlo.. Soy diseñador gráfico, entrando al mundo de programación.. dificil pero cada día me encanta mas.. Aquí va mi método de como resolví.. es mi primer aporte a la comunidad..Salió todo correcto en el playground. Ok, I had a headache .. for this exercise of 3 days hahaha but I managed to solve it .I am a graphic designer, entering the program of programming, Difficult but every day I love more. Here is my method of how I resolved .. it is my first contribution to the community ... everything is correct in the playground. peso = float(input()) altura = float(input()) imc = peso // altura**2 if imc < 18.5: print ("Underweight") elif (imc == 18.5) or (imc <= 24.9): print ("Normal") elif (imc == 25) or (imc <= 29.9): print ("Overweight") else: if Imc >= 30: print ("Obesity") El punto importante, en mi programa.. es el operador // .. si no hubiera puesto de està forma me arrojaba error, pero era extraño porque de 5 vistos buenos tenia uno no acertado.. que fueron 3 dias ..hasta que lo descrubí que era .. simplemente ese operador.. The important point in my program... is the // operator... if I hadn't put it this way, it would throw me an error, but it was strange because out of 5 approvals I had one that was not correct... which was 3 days...until I I discovered that it was .. just that operator ..
18th Feb 2022, 8:37 PM
Andres cedeño
Andres cedeño - avatar
0
peso = int(input()) altura = float(input()) imc = ( peso / altura ** (2)) if imc >= 30.0: print("Obesity") if imc >= 25.0 and imc <= 29.9: print("Overweight") if imc >= 18.5 and imc <= 24.9: print("Normal") if imc <= 18.4: print("Underweight")
24th May 2021, 8:26 AM
Carmen Chirinos
Carmen Chirinos - avatar
0
Yeah... Why?
24th May 2021, 8:47 AM
Carmen Chirinos
Carmen Chirinos - avatar
0
OMG. Is really? :( But, My example is correcto?
24th May 2021, 8:56 AM
Carmen Chirinos
Carmen Chirinos - avatar
0
Nunca he usando Python pero creo q el problema esta en seleccionar menor y menor igual. En tu codigo si el imc resulta 29.9753, cual seria el Print que se ejecuta? peso = int(input()) altura = float(input()) imc = ( peso / altura ** (2)) if imc >= 30.0: print("Obesity") if imc >= 25.0 and imc < 30: print("Overweight") if imc >= 18.5 and imc < 25: print("Normal") if imc < 18.5: print("Underweight")
24th May 2021, 9:30 AM
Arturop
Arturop - avatar
0
La segunda condición (if) debe ser menor que 30 (<30), al igual que la tercera condición debe ser menor que 25
24th May 2021, 1:54 PM
Johny Marin
Johny Marin - avatar
0
Notice the value of the and statement
25th May 2021, 10:20 PM
Hassan Adedoyin
Hassan Adedoyin - avatar
0
What is error ?
26th May 2021, 7:31 AM
Tiger Coder
Tiger Coder - avatar
0
Aqui mi codigo por lo q lei hay q ajustar debido a float sercano no es asi? #tu código va aquí peso=int(input()) altura=float(input()) imc=peso/(altura**2) if imc <=18.4: print('Underweight') elif imc >= 18.5 and imc <=24.9: print('Normal') elif imc >= 25 and imc <=29.9: print('Overweight') elif imc >=30: print ('Obesity')
19th Aug 2021, 4:30 PM
Serguei Castillo Castillo
Serguei Castillo Castillo - avatar
0
Andres también me pasó lo mismo, pero no se porque era el operador? Debo de averiguar más sobre ello porque no supe
11th Jul 2022, 4:49 PM
Harol Steven
Harol Steven - avatar
0
¿Qué procede? peso=int(input()) altura=float(input()) imc=peso/altura**2 if imc < 18.5: print("Underweight") elif (imc>=18.5)and(imc<=24.9): print("Normal") elif (imc>=25)and(imc<=29.9): print("Overweight") elif imc>=30: print("Obesity")
30th Jul 2022, 5:22 AM
MARIA DE LOS ANGELES ANDREA ROMANI HERRERA
- 1
Everything is correct in both Russian and Spanish. It's just that the creator of this test decided to complicate the task for us, considering us smarter than the rest. 😃 We need to round the result to tenths. https://code.sololearn.com/WR464s9kP5Oq/?ref=app
24th May 2021, 10:09 AM
Solo
Solo - avatar