You are viewing a single comment's thread from:

RE: Steemers Coding Class 03 - Learn Coding 10 Minutes a Day For Very Beginners

in #howto9 years ago

I used the following code to get the answer:
i = sum(range(1, 1001))
print(i)

It doesn't look like you need to use a loop to get a result.

Sort:  

Excellent. The function sum() is also running a loop under the hood to calculate that. But the goal of this article is not to learn how to sum numbers, it's to learn how to use iterations because they have a much wider use cases in coding. Thank you for contribution