I want these items to have and brought 13250
(10000 + 2000 + 1250
).
Answer 1, Authority 100%
the shortest way
print (SUM (LIS))
Answer 2, Authority 43%
That’s how:
import Functools, Operator
LIS = [10000, 2000, 1250]
Print (Operator.add, Lis))
Answer 3, Authority 29%
lis = [10000, 2000, 1250]
Sum = 0.
For i in lis:
SUM + = I
Print (SUM)
So you can practice in iterative objects
Answer 4, Authority 14%
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)
Answer 5
-
lis = [10000, 2000, 1250] Print (SUM (LIS))
-
lis = [10000, 2000, 1250] Sum = 0. For i in lis: SUM + = I Print (SUM)