Skip to content

Commit c24e748

Browse files
HackerRank Python
1 parent ebef5e7 commit c24e748

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

HackerRank_Lists.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
if __name__ == "__main__":
2+
N = int(input())
3+
res = []
4+
for _ in range(N):
5+
6+
lst = list(map(str, input().rstrip().split()))
7+
8+
9+
if lst[0] == 'insert':
10+
res.insert(int(lst[1]), int(lst[2]))
11+
12+
elif lst[0] == 'print':
13+
print(res)
14+
15+
elif lst[0] == 'remove':
16+
res.remove(int(lst[1]))
17+
18+
elif lst[0] == 'append':
19+
res.append(int(lst[1]))
20+
21+
elif lst[0] == 'sort':
22+
res.sort()
23+
24+
elif lst[0] == 'pop':
25+
res.pop()
26+
27+
elif lst[0] == 'reverse':
28+
res.reverse()
29+
30+

0 commit comments

Comments
 (0)