You are viewing a single comment's thread. Return to all comments →
Here is My working Python3 snippet:
Method 1: Using inbuilt function "sum"
def simpleArraySum(ar): return (sum(ar))
Method 2: Using Length of array function "len"
def simpleArraySum(ar): sum1 = 0 for i in range(len(ar)): sum1 = sum1 + ar[i] return sum1
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 →
Here is My working Python3 snippet:
Method 1: Using inbuilt function "sum"
Method 2: Using Length of array function "len"