<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at. The query string (? and beyond) may be truncated.>
Trying to write a Conditional Logic Program… Having an issue with the Operators.
When I run it in the module, the Output states “Low blood sugar.” when it should state “Slightly high blood sugar.”
The value is 102.
Any examples to help me learn what I’m doing wrong here would be greatly appreciated. Thanks!
<In what way does your code behave incorrectly? Include ALL error messages.>
<What do you expect to happen instead?>
```python#!/usr/bin/env python
“”" Test “”"
import json
def test_blood_glucose():
blood_glucose = ‘{“value”: “102”, “unit”: “mg/dL”}’
parsed_json = json.loads(blood_glucose)
print(parsed_json[‘value’])
print(parsed_json[‘unit’])
glucose_reading = (parsed_json[‘value’])
if (glucose_reading >= ‘1.00’ and glucose_reading <= ‘68.00’):
print “Low blood sugar.”
elif (glucose_reading >= ‘69.00’ and glucose_reading <= ‘98.00’):
print “Normal blood sugar.”
elif (glucose_reading >= ‘99.00’ and glucose_reading <= ‘125.00’):
print “Slightly high blood sugar.”
elif (glucose_reading >= ‘126.00’ and glucose_reading <= ‘198.00’):
print “High blood sugar.”
elif (glucose_reading >= ‘199.00’ and glucose_reading <= ‘918.00’):
print “Very high blood sugar.”
else:
print “Nothing to say.”
test_blood_glucose()
test_blood_glucose()
<do not remove the three backticks above>