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:
$$ b^n = \underbrace{b \times b \times \ldots \times b}_{n} $$
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 + \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \ldots$$