Write the formulas of a geometric progression yourself, with exact fractions, and test them against plain adding.
The idea. , for and for , and for .
Your tasks.
nth_term, return .gp_sum, return the sum of the first n terms by the formula. Handle r == 1 on its own.sum_to_infinity, return , or None when .Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…
With Standard, you also open 11 more problems, 2 Python labs and 1 extra course. Everything you have used here stays free, always.