#๐ Dont know whats wrong
12 messages ยท Page 1 of 1 (latest)
@lethal locust
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!code
Hey @lethal locust!
It looks like you pasted Python code without syntax highlighting.
Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.
To do this, use the following method:
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
You can **edit your original message** to correct your code block.
def process_data(data_stream):
# Split the data stream into elements using commas as separators
elements = data_stream.split(',')
# Initialize lists to store different types of readings
blood_sugar = []
pulse_rate = []
max_blood_pressure = []
alphanumeric = []
# Organize the elements into different lists based on their type
for element in elements:
if element.isdigit():
value = int(element)
if value < 30:
blood_sugar.append(value)
elif 30 <= value <= 120:
pulse_rate.append(value)
else:
max_blood_pressure.append(value)
else:
alphanumeric.append(element)
# Check for emergency conditions
emergency_count = 0
if any(sugar > 10 for sugar in blood_sugar):
emergency_count += 1
if any(rate <= 50 for rate in pulse_rate):
emergency_count += 1
if any(pressure > 175 for pressure in max_blood_pressure):
emergency_count += 1
if any(element.startswith('magnesium') and float(element.split('magnesium')[1]) > 2.5 for element in alphanumeric):
emergency_count += 1
if any(element.startswith('potassium') and float(element.split('potassium')[1]) < 0.025 for element in alphanumeric):
emergency_count += 1
if any(element.startswith('pH') and (float(element.split('pH')[1]) < 5.0 or float(element.split('pH')[1]) > 8.5) for element in alphanumeric):
emergency_count += 1
# Determine emergency status
emergency_status = "EMERGENCY" if emergency_count >= 3 else "ALLOK"
# Print the emergency status
print(emergency_status)
where is the test case that does not work?
im sorry ill come back later to you guys for the help
do i have to close this channel?
it is appreciated
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ Dont know whats wrong