Sunday 20 December 2020

Python: Get sum of list of numbers

‘sum’ function takes a list as argument and return sum of list of numbers.

>>> list1 = [1, 2, 3, 4, 5]
>>> 
>>> sum(list1)
15

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment