Processing math: 100%

CPSC120A
Fundamentals of Computer Science I

Post-lab 13

Accumulator

Do one of the following programming problems:

Power Function

Create a function called compute_power(base, exponent), which recieves two parameters: a floating point value representing the base of the power, and an integer representing the exponent. Your function should return a floating point value representing the result of raising the base to the specified exponent. Your function should not use the ** operator.

Recall that exponentiation is:

bn=b×b××bn

Where there are n occurances of b in the terms on the right hand side of the equation.


Geometric Series

Create a function called geometic_series(num_terms) that computes the sum of the specified number of terms of the series:

1+12+14+18+116+