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.
Hello, here is my solution in Python 3. Hope this helps someone!
#!/bin/python3importmathimportosimportrandomimportreimportsys## Complete the 'simpleArraySum' function below.## The function is expected to return an INTEGER.# The function accepts INTEGER_ARRAY ar as parameter.#defsimpleArraySum(ar):# Write your code heresum=0foriinar:sum+=ireturnsumif__name__=='__main__':fptr=open(os.environ['OUTPUT_PATH'],'w')ar_count=int(input().strip())ar=list(map(int,input().rstrip().split()))result=simpleArraySum(ar)fptr.write(str(result)+'\n')fptr.close()
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 →
Hello, here is my solution in Python 3. Hope this helps someone!