0

Please suggest the code for Adding of n numbers in python?

I want to send n numbers as input to a function and add them up.

7th Nov 2016, 9:44 AM
pothala jagadeesh
pothala jagadeesh - avatar
1 ответ
+ 4
you can use the built-in sum function and a list: n = [x for x in range(1,11)] # creates list [1,2,3,...,10] print(sum(n)) # prints the result of sum on n also possible to change the [ ] brackets to ( ) so you get a tuple instead a list
8th Nov 2016, 7:46 AM
Burey
Burey - avatar