We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
To solve this problem, we need to calculate the sum of the elements in the given array. Here's how you can implement the function simpleArraySum in Python:
defsimpleArraySum(ar):# Return the sum of the array elementsreturnsum(ar)# Read inputn=int(input())#Thisreadsthesizeofthearray(thoughit'snotnecessarytouseitdirectly)ar=list(map(int,input().split()))#Thisreadsthearrayelements# Print the resultprint(simpleArraySum(ar))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Array Sum
You are viewing a single comment's thread. Return to all comments →
To solve this problem, we need to calculate the sum of the elements in the given array. Here's how you can implement the function
simpleArraySum
in Python: