Cursor wrote this and sum no longer works the way it should. The
actual bug is on line 3: sum = 99 shadows Python's built-in
sum() function. (from math import * is bad practice — it
hides where names came from and risks future collisions — but it's
not the proximate cause here, because math doesn't export a sum
to clash with.)
Two-part fix that addresses both the immediate bug and the bad
habit: replace the star import with a targeted import that brings
in only pi and sqrt, AND remove the line that reassigns sum.
After both fixes, the script should print:
3.141592653589793
9.0
6
The break is on lines 1, 3 — but read the whole snippet first.