Home python Find the sum of numbers in the list

# Find the sum of numbers in the list

Author

Date

Category

I want these items to have and brought `13250 `(`10000 + 2000 + 1250 `).

the shortest way

``````print (SUM (LIS))
``````

That’s how:

``````import Functools, Operator
LIS = [10000, 2000, 1250]
``````

``````lis = [10000, 2000, 1250]
Sum = 0.
For i in lis:
SUM + = I
Print (SUM)
``````

So you can practice in iterative objects

And so you can practice the Range method:

``````lis = [10000, 2000, 1250]
Sum = 0.
For i in Range (LEN): # Argument: Stop
SUM + = LIS [i]
Print (SUM)
``````

So from the end:

``````lis = [10000, 2000, 1250]
Sum = 0.
For i in Range (LEN (LIS) -1, -1, -1): # Arguments: Start, Stop, Step
SUM + = LIS [i]
Print (SUM)
``````

• ``````lis = [10000, 2000, 1250]
Print (SUM (LIS))
``````
• ``````lis = [10000, 2000, 1250]
Sum = 0.
For i in lis:
SUM + = I
Print (SUM)
``````

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.