id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav1780@gmail.com 03_loops > sum_series
prev  |  next  |  chance

Define a function that when passed the parameters of an arithmetic progression, namely, the value of the first item, the change from one value to the next, and the next of terms, returns the sum of the series. For example, 10, 2, 3 represents a series of 3 items starting at 10 and each item is 2 more than the one before. Mathematically, this can be done without a loop as well.


sum_series(1, 1, 10) → 55
sum_series(1, 2, 5) → 25
sum_series(10, 2, 3) → 36

...Save, Compile, Run (ctrl-enter)

def sum_series(start, change, n):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 2 Post-solution available

Copyright Nick Parlante 2017 - privacy