Practice 1
Write a function sum_powers(n)
, which
computes the sum of the numbers in the set:
Practice 2
Write a function called compute_product(n)
, which
computes the series:
Practice 3
Write a function called clamp_even(n, minimum,
maximum)
, which
returns the value of n "clamped" to the range \([minimum,
maximum]\) only if n is even. If n is odd,it
should return n.
Clamping is a process where values less than the specified minimum
get set to the minimum, and values greater than the maximum get
set to the maximum. Any value in the range stays the same.
Submission
Please show your source code and run your programs for the instructor or lab assistant. Only a programs that have perfect style and flawless functionality will be accepted as complete.