From 588291f7f7f42797337baef919bd3a305b00908c Mon Sep 17 00:00:00 2001 From: arpit05va <72192202+arpit05va@users.noreply.github.com> Date: Fri, 8 Oct 2021 18:46:50 +0530 Subject: [PATCH] Create sum.py --- sum.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sum.py diff --git a/sum.py b/sum.py new file mode 100644 index 0000000..98d242d --- /dev/null +++ b/sum.py @@ -0,0 +1,13 @@ +# Python program to find sum of elements in list +total = 0 + +# creating a list +list1 = [11, 5, 17, 18, 23] + +# Iterate each element in list +# and add them in variable total +for ele in range(0, len(list1)): + total = total + list1[ele] + +# printing total value +print("Sum of all elements in given list: ", total)