+ 1
can someone enlighten me with this practice!!! Thank you. Medical Software
This is my code on Medical Software practice in Introduction to Python. This is my attempt, i got test case 2,3 correct and 1 was fail. # Glucose level is an input for this software glucose_level = int(input()) if glucose_level <=70: # Display message if glucose level is less than 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")
6 Respostas
+ 5
what will be the output if the input is 60?
then the first condition is true and the last on and so you get two outputs. see the attachment, but this is wrong. you need only one output.
do you learnd already someting about the elif statement?
https://code.sololearn.com/cDGisZ7vnCC8/?ref=app
+ 2
num = 60
glucose_level = int (input())
if glucose_level <= 70:
print ("Low glucose_level")
elife glucose_level > 140:
print ("High glucose_level")
else:
print ("Normal range")
this working
+ 2
this code is also good, my opinion is equal and less is better
+ 1
thank you so much, i solved that practice, i should ve focused more on elif
0
this is the solution
# 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
elif glucose_level > 140:
print("High glucose level")
# Display message if none of the conditions above are met
else :
print("Normal range")
this code will work
they mention less than 70. You write less than or equal 70
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")