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?
7 Respuestas
+ 4
try a if-else if-else chain instead of a if-if-else
+ 3
We cannot see your code.
If you want us to check your code, show your complete code and give a complete task description.
+ 2
I never made any medical software so never experienced.
You need to check code step by step. You have to debug your code.
+ 1
Ok, thank you Mrs. Lisa! I will give it a try.
+ 1
It worked!
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.
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