Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save codeperfectplus/934ae56572a9be30deeb86393c052b9b to your computer and use it in GitHub Desktop.

Select an option

Save codeperfectplus/934ae56572a9be30deeb86393c052b9b to your computer and use it in GitHub Desktop.
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'simpleArraySum' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER_ARRAY ar as parameter.
#
def simpleArraySum(ar: list):
sum = 0
for element in ar:
sum += element
return sum
if __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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment