Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4781ef0

Browse files
Checking multiple inut with a sum program
1 parent 788cf09 commit 4781ef0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎other_dsa/array_sum_multiple_input.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 2
2+
# 5
3+
# 1 2 3 4 5
4+
# 10
5+
# 5 7 5 7 5 7 5 7 5 7
6+
7+
test_cases = input('Enter number of test_cases')
8+
9+
for i in range(int(test_cases)):
10+
n = int(input())
11+
arr = input()
12+
arr = list(map(int, arr.split(' ')))
13+
sum = 0
14+
for j in range(n):
15+
sum += int(arr[j])
16+
print (sum)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /