Style

It has to be said. When you write a pg-language problem either pretend you are writing it for a colleague who knows absolutely nothing, or for yourself realizing that any cleverness and insight you may have at the moment will have vanished in a month.

That means several things. Annotate your problem with comments (lines beginning with a #). Say useful things, like ``don't change the range of values of these variables, roundoff error will drive you mad'', or the variable $number_of_terms refers to the number of terms in the partial sum of the series.

Use variable names which describe themselves. I hate reading programs with variables $x1, $x2, $xx1 and so on. Use descriptive variables like $length_of_ladder or $distance_from_wall. It's unlikely the extra typing will give you carpal tunnel syndrome, and everyone will appreciate the effort, especially you next term when you find a bug in your problem and have to fix it.