Correct the sample code

Also considered renaming the variable to `total` but I felt like leaving it as `sum` and using the module as a prefix for the function would be clearer.