# Popcorn Hack - wildfire dispatch scanner
# Theme: The SFSRC team scans wildfire alert levels from different zones.
# Goal: skip safe zones, count response zones, total their alert scores, and stop at the first critical zone.
alerts = [1, 4, 2, 6, 3, 9, 5]
# Pick the cutoff for safe alerts. Alerts below this number should be skipped.
safe_cutoff = 3
# Pick the cutoff for critical alerts. The loop should stop at this number or higher.
critical_cutoff = 8
# Counters and totals start at 0 because no alerts have been processed yet.
action_count = 0
safe_count = 0
total_action_score = 0
critical_found = False
# Loop through the alert list.
for alert in alerts:
# If the alert is safe, count it, print a message, and skip to the next alert.
if alert < safe_cutoff:
safe_count += 1
print("Alert " + str(alert) + ": safe, skipping")
continue
# If code reaches here, the alert needs action.
# Count this action alert and add its score to the running total.
action_count += 1
total_action_score += alert
print("Alert " + str(alert) + ": action needed")
# If this alert is critical, mark it and stop the scan.
if alert >= critical_cutoff:
critical_found = True
print("Critical alert found - stopping scan")
break
# Final report: these lines should explain what happened during the scan.
print("Safe alerts skipped: " + str(safe_count))
print("Action alerts: " + str(action_count))
print("Total action score: " + str(total_action_score))
print("Critical found: " + str(critical_found))
Alert 1: safe, skipping
Alert 4: action needed
Alert 2: safe, skipping
Alert 6: action needed
Alert 3: action needed
Alert 9: action needed
Critical alert found - stopping scan
Safe alerts skipped: 2
Action alerts: 4
Total action score: 22
Critical found: True
# Homework Hack - themed loop-based checker
# Theme: Cat Cafe Stimulation Monitor
# Goal: skip sleeping/chill cats, count playful cats, total their stimulation scores, and stop at the first overstimulated cat.
cat_stimulation_levels = [15, 45, 20, 60, 10, 85, 50, 95, 30]
# Values below safe_cutoff (chill/sleeping) should be skipped with continue.
safe_cutoff = 30
# Values at or above critical_cutoff (dangerously overstimulated) should stop the loop with break.
critical_cutoff = 90
# Summary variables.
checked_count = 0
action_count = 0
skipped_count = 0
total_score = 0
critical_found = False
# Traverse every value in your list until a critical value stops the scan.
for level in cat_stimulation_levels:
# Count every value the loop looks at.
checked_count += 1
# Skip safe values. Remember to count them before continuing.
if level < safe_cutoff:
skipped_count += 1
print(str(level) + ": cat is chill, no action")
continue
# If code reaches here, this value needs action.
# Count it and add it to the running total.
action_count += 1
total_score += level
print(str(level) + ": playtime needed")
# Stop early if this value is critical.
if level >= critical_cutoff:
critical_found = True
print("Critical stimulation value found. Pawsing operations.")
break
# Final report. These labels should make sense for your theme.
print("\nFinal Report")
print("Cats Checked: " + str(checked_count))
print("Cats Skipped (Chill): " + str(skipped_count))
print("Cats Needing Play: " + str(action_count))
print("Total Play Score: " + str(total_score))
print("Critical Overstimulation Found: " + str(critical_found))
15: cat is chill, no action
45: playtime needed
20: cat is chill, no action
60: playtime needed
10: cat is chill, no action
85: playtime needed
50: playtime needed
95: playtime needed
Critical stimulation value found. Pawsing operations.
Final Report
Cats Checked: 8
Cats Skipped (Chill): 3
Cats Needing Play: 5
Total Play Score: 335
Critical Overstimulation Found: True