p_flu = 0.
10 # 10% of population has flu
p_fever_flu = 0.90 # 90% with flu have fever
p_cough_flu = 0.80 # 80% with flu have cough
p_fever = 0.25 # 25% of all people have fever
p_cough = 0.35 # 35% of all people have cough
fever = input("Does patient have fever? (yes/no): ").lower() == "yes"
cough = input("Does patient have cough? (yes/no): ").lower() == "yes"
prob = p_flu
if fever: prob = prob * p_fever_flu / p_cough
if cough: prob = prob * p_cough_flu / p_fever
print(f"\nEstimated flu probability: {prob:.1%}")
if prob > 0.50: print("Likely flu — rest, fluids, monitor.")
else: print("Flu unlikely — observe other causes.")
# Blood Sugar Trend Predictor — 7-day analysis
import [Link] as plt
import numpy as np
# ── Patient data ───────────────────────────────
patient = "Ahmed Khan"
days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
morning = [95, 112, 148, 178, 165, 132, 108]
evening = [130, 158, 193, 215, 188, 162, 125]
# ── Classification function ────────────────────
def classify(level):
if level < 70: return "LOW", "red"
elif level <= 140: return "NORMAL", "green"
elif level <= 199: return "PRE-DIABETIC", "orange"
else: return "HIGH", "crimson"
# ── Plot ───────────────────────────────────────
fig, ax = [Link](figsize=(8, 4))
[Link]( 0, 70, color="red", alpha=0.12)
[Link]( 70, 140, color="green", alpha=0.10)
[Link](140, 200, color="orange", alpha=0.12)
x = [Link](len(days))
[Link](x, morning, "o-", color="teal", label="Morning")
[Link](x, evening, "s--", color="orange", label="Evening")
ax.set_xticks(x); ax.set_xticklabels(days)
ax.set_title(f"7-Day Trend — {patient}"); [Link]()
[Link]("sugar_chart.png", dpi=150, bbox_inches="tight")
[Link]()
# ── Summary Report ─────────────────────────────
avg_m = sum(morning)/len(morning)
avg_e = sum(evening)/len(evening)
peak = max(morning + evening)
status, _ = classify(peak)
print(f"Avg Morning : {avg_m:.1f} mg/dL")
print(f"Avg Evening : {avg_e:.1f} mg/dL")
print(f"Peak Reading: {peak} mg/dL → {status}")