0

I have a glitch

Hey guys! I’m stuck at the “medical software” level, and I can’t understand why. Everything is well written, but when I run the code something happens and it doesn’t go through. Can you please help me with this? Have you experienced it too?

7th Jul 2023, 11:10 AM
Maria Luísa Cunha
Maria Luísa Cunha - avatar
7 Respuestas
+ 4
try a if-else if-else chain instead of a if-if-else
7th Jul 2023, 12:54 PM
Lisa
Lisa - avatar
+ 3
We cannot see your code. If you want us to check your code, show your complete code and give a complete task description.
7th Jul 2023, 12:19 PM
Lisa
Lisa - avatar
+ 2
I never made any medical software so never experienced. You need to check code step by step. You have to debug your code.
7th Jul 2023, 12:40 PM
A͢J
A͢J - avatar
+ 1
Ok, thank you Mrs. Lisa! I will give it a try.
7th Jul 2023, 12:55 PM
Maria Luísa Cunha
Maria Luísa Cunha - avatar
+ 1
It worked!
7th Jul 2023, 12:57 PM
Maria Luísa Cunha
Maria Luísa Cunha - avatar
0
Below I show you the the task that Sololearn gave me: Complete the given code to display different messages to the patient based on the blood sugar levels, knowing that the Inputs for glucose levels are: 60 = low glucose level | 100 = normal glucose level | 150 = high glucose level. This is how I solved: # Glucose level is an input for this software glucose_level = int(input()) # Display message if glucose level is less than 70 if glucose_level <70: print("Low glucose level") # Display message if glucose level is greater than 140 if glucose_level>140: print("High glucose level") # Display message if none of the conditions above are met else: print("Normal range") My issue is: when I try to run, my output for the first testcase (where the input is 60, low level) is low glucose level *and* normal range. I don’t understand what I could have possibly done wrong.
7th Jul 2023, 12:47 PM
Maria Luísa Cunha
Maria Luísa Cunha - avatar
0
# Glucose level is an input for this software glucose_level = int(input()) # Display message if glucose level is less than 70 if glucose_level==60: print("Low glucose level") # Display message if glucose level is greater than 140 elif glucose_level==150: print("High glucose level") # Display message if none of the conditions above are met else: print("Normal range") Budhabhushan Waghmare @techbrainbooster
12th Sep 2024, 1:50 PM
Budhabhushan Waghmare
Budhabhushan Waghmare - avatar