From 2643155c3721c102e499f8f3f7daa225689a7a8b Mon Sep 17 00:00:00 2001 From: Sagar Malik <63491829+sagar2002malik@users.noreply.github.com> Date: Tue, 5 Oct 2021 17:16:51 +0530 Subject: [PATCH] Sum of array Displays the sum of the array --- sum_array.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sum_array.py diff --git a/sum_array.py b/sum_array.py new file mode 100644 index 0000000..464c2e9 --- /dev/null +++ b/sum_array.py @@ -0,0 +1,9 @@ +def sum(arr): + sum=0 + for i in arr: + sum+=i + return sum + +arr=[] +arr=[1,2,3] +print(sum(arr))