maynul67

sum elements of a list

Jul 9th, 2021
1,003
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def sum_ele(list):
  2.     sum = 0
  3.     for ele in list:
  4.             sum = sum + ele
  5.     return sum
  6.  
  7. list = [1,2,3,4,5,6]
  8. a = sum_ele(list)
  9. print(a)
  10.  
RAW Paste Data