Y
Hacker News
new
|
ask
|
show
|
jobs
by
gshubert17
761 days ago
Since the first element in range() will be 0, should the last line be ...?
return prod(1,range(n+1))
1 comments
asplake
761 days ago
Oops yes! And unfortunately it still doesn't work for n=0
Edit: prod(range(1, n+1)) does work
link
gshubert17
761 days ago
My oops too. The extra 1 argument belongs with range, as you have it here.
link
Edit: prod(range(1, n+1)) does work