From 14db9eb300fcd8ec7435e8b184629516984105e3 Mon Sep 17 00:00:00 2001 From: SushmitaY <30928963+SushmitaY@users.noreply.github.com> Date: Tue, 24 Oct 2017 20:53:09 +0530 Subject: [PATCH] Update list_sum.py Changes to function lsum() Remove parameter 'n' i.e the length of the list and update the loop construct as follows: for ele in ls: sum += ele --- listsum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listsum.py b/listsum.py index 6ba8e17..e81e24e 100644 --- a/listsum.py +++ b/listsum.py @@ -15,8 +15,8 @@ def lsum(n,ls): the value of the variable sum can be upadated simultaneously ''' sum=0 - for i in range(0,n): - sum+=ls[i] + for ele in ls: + sum += ele return sum