promptdojo_

Diagnose any crash in one read — step 5 of 9

Cursor wrote a function that computes the average revenue per order. When there are no orders yet, it crashes with ZeroDivisionError.

Add a one-line guard so that when orders is 0, the function returns 0 instead of crashing. The script should print avg: 0.

The break is on line 2 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.