1please subscribe my channel - https://bit.ly/2Me2CfB
2
3# METHOD 1 (without using the sum function) :
4
5def list_sum(list_name):
6 value = 0
7 for values in list_name:
8 value += values
9 print(value)
10
11
12# -------------------------------------------
13
14
15# METHOD 2 (using the sum function) :
16
17p = [1,5,3,4,6,7]
18p_sum = sum(p)
1# to sum all the numbers we use python's sum() function
2a = [4,5,89,5,33,2244,56]
3a_total = sum(a)
1def int_list(grades): #list is passed to the function
2 summ = 0
3 for n in grades:
4 summ += n
5 print summ
6