[Tutor] Not returning out the series
nulla.epistola at web.de
Tue Jul 4 04:57:45 EDT 2017
Am 04.07.2017 um 04:40 schrieb Rafael Skovron:
> Hi as a challenge I have got to sum a series i / (i+1). My code isn't
> summing right. Any ideas why?
> def main():
> for i in range(1,20):
> def m(i):
> total = 0
> for i in range(1,i+1,1):
> return total
Python 2 or Python 3? What sums do you get and what sums do you expect?
BTW in your function m(i) it's very confusing that you use the name i
both for the range limit and for the loop variable. It seems to be
syntactically correct, but it's certainly not readable.
More information about the Tutor