Answers for "write a python program to sum all the numeric items in a list"

2

how to sum numbers of a list in python without sum

please subscribe my channel - https://bit.ly/2Me2CfB

# METHOD 1 (without using the sum function) :

def list_sum(list_name): 
    value = 0 
    for values in list_name:
        value += values
        print(value)
        
        
# -------------------------------------------


# METHOD 2 (using the sum function) :

p = [1,5,3,4,6,7]
p_sum = sum(p)
Posted by: Guest on July-09-2021
7

how to sum all the numbers in a list in python

# to sum all the numbers we use python's sum() function
a = [4,5,89,5,33,2244,56]
a_total = sum(a)
Posted by: Guest on February-25-2021

Code answers related to "write a python program to sum all the numeric items in a list"

Python Answers by Framework

Browse Popular Code Answers by Language