-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path10.py
More file actions
29 lines (29 loc) · 737 Bytes
/
10.py
File metadata and controls
29 lines (29 loc) · 737 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
if __name__ == '__main__':
N = int(input())
l=[]
for i in range(N):
Comm=input()
inp=Comm.split()
if len(inp)==1:
comm=inp[0]
elif len(inp)==2:
comm=inp[0]
arg1=int(inp[1])
elif len(inp)==3:
comm=inp[0]
arg1=int(inp[1])
arg2=int(inp[2])
if comm=='insert':
l.insert(arg1,arg2)
elif comm=='print':
print(l)
elif comm=='append':
l.append(arg1)
elif comm=='remove':
l.remove(arg1)
elif comm=='pop':
l.pop(len(l)-1)
elif comm=='sort':
l.sort()
elif comm=='reverse':
l.reverse()