-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsolution.py
More file actions
33 lines (29 loc) · 825 Bytes
/
solution.py
File metadata and controls
33 lines (29 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Script: solution.py
# @Author: Pradip Patil
# @Contact: @pradip__patil
# @Created: 2018-02-11 12:56:58
# @Last Modified By: Pradip Patil
# @Last Modified: 2018-02-12 00:23:57
# @Description: https://www.hackerrank.com/challenges/python-lists/problem
if __name__ == '__main__':
n = int(input())
l = []
while n > 0:
i = input().split()
if i[0] == 'insert':
l.insert(int(i[1]), int(i[2]))
elif i[0] == 'remove':
l.remove(int(i[1]))
elif i[0] == 'append':
l.append(int(i[1]))
elif i[0] == 'sort':
l.sort()
elif i[0] == 'pop':
l.pop()
elif i[0] == 'reverse':
l.reverse()
elif i[0] == 'print':
print(l)
n -= 1