Last active
September 10, 2023 06:55
-
-
Save codeperfectplus/934ae56572a9be30deeb86393c052b9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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