Tuesday, 10 September 2013

python: adding up int. results of a FOR loop [on hold]

python: adding up int. results of a FOR loop [on hold]

On day 1 I do 20 pushups. Each day I do yesterday's amount + 1. How many
pushups will I have done in a year's time?
Here we go, python:
day1_amount = 20
for i in range(1, 365):
print sum(day1_amount + i)
I'm getting an error:
TypeError: 'int' object is not iterable

No comments:

Post a Comment