Hi All,
I am a newbie to python. Trying to simulate the sum function to add all the values in a LIST
I am trying this code in anacondo Spyder.
where am i going wrong????
I am a newbie to python. Trying to simulate the sum function to add all the values in a LIST
#list orig= [1,2,3,4,5] #function def sum2(data): a=0 for i in data: a=a+i return a #calling function sum2(orig)
Output:#result
1
i am expecting (15) .I am trying this code in anacondo Spyder.
where am i going wrong????