The only way your script can fill up your disk is if it creates large/many temporary files and doesn't clean up. Just running a Python program cannot itself fill up your disk.
To recover the disk space, you need to figure out where the space is spent and remove the temporary files. Not sure how to do that on OSX, though. On Windows and Linux there are several excellent tools for visualizing disk usage.
EDIT: Euler-problems are designed to be solved in under a minute, even on modestly powerful computers. If you're spending 5 minutes, you're approaching the problem the wrong way.