CPSC120B
Fundamentals of Computer Science I

Post-lab 6

Accumulator

The accumulator pattern appears in a lot of mathematical structures. In this post-lab you will demonstrate your understanding of the accumulator pattern by writing a simple sum function.

Details

In a file called reciprical.py, write a program which computes the sum of the first n reciprical floating point numbers. Your program should prompt the user for the integer n. Your program should compute:

$$\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \ldots + \frac{1}{n}$$

Submission

Submit your code on the course Inquire site.