Skip to content

Commit 5ed4b7f

Browse files
author
Kai
committed
update solutions
1 parent d879007 commit 5ed4b7f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

warmup/simple-array-sum.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://www.hackerrank.com/challenges/simple-array-sum/problem
2+
3+
#!/bin/python3
4+
5+
import os
6+
import sys
7+
8+
#
9+
# Complete the simpleArraySum function below.
10+
#
11+
def simpleArraySum(ar):
12+
sum = 0
13+
for ar_i in ar:
14+
sum += ar_i
15+
return sum
16+
17+
if __name__ == '__main__':
18+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
19+
20+
ar_count = int(input())
21+
22+
ar = list(map(int, input().rstrip().split()))
23+
24+
result = simpleArraySum(ar)
25+
26+
fptr.write(str(result) + '\n')
27+
28+
fptr.close()

warmup/solve-me-first.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://www.hackerrank.com/challenges/solve-me-first/problem
2+
3+
def solveMeFirst(a, b):
4+
return a + b
5+
6+
7+
num1 = int(input())
8+
num2 = int(input())
9+
res = solveMeFirst(num1, num2)
10+
print(res)
11+

0 commit comments

Comments
 (0)