These problems are a make-up exercise for problem 7a on the paper part of Exam 2. Your score on this assignment will replace your score on that problem of the exam. If you earned 7 points out of the 7 available on the exam problem, then you do not have to complete this assignment.
Study the function fixResult() in exercises.py. The function does not satisfy its specification as given by its docstring. Fix the bug.
When fixed, the first output of the program should be:
Testing fixResult 10 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 55 -10 [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] 80
Implement the function squareEach() so that it satisfies its specification as given by its docstring. When fixed, the output for this part of the program should be:
Testing squareEach Before: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] After: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] Before: [0, 2, 4, 6, 8] After: [0, 4, 16, 36, 64] Before: [1, 3, 5, 7, 9] After: [1, 9, 25, 49, 81] Before: [1, 2, 3, 4] After 1 iterations: [1, 4, 9, 16] After 2 iterations: [1, 16, 81, 256] After 3 iterations: [1, 256, 6561, 65536] After 4 iterations: [1, 65536, 43046721, 4294967296L]