[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code for addition

On Sat, 5 Aug 2017 12:43 pm, Ode Idoko wrote:

> Can anyone help with the python code that can add 101, 102, 103...2033 please?

Sounds like homework. Here are some hints for you to play around with and see if
you can get the right answer:

sum([101, 102, 103])

range(101, 104)

sum(range(1, 4))

What does sum() do?

What does range() do?

Can you put them together to get the answer you need?

?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.