You don't say what line you get the error on, but you should check carefully the spelling of the variable name(s).
I would guess that Python would give a "name not defined" error on either line 11 or line 16. It doesn't appear that the variable used on those lines will have been assigned a value.

I was thinking the same as above. We work through the program, get to the while loop, and say ' while remainder...' Well, there is not a remainder object in existence yet, so the programs logic grinds to a halt !