forked from arsho/Hackerrank_Python_Domain_Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLists.py
More file actions
38 lines (38 loc) · 928 Bytes
/
Copy pathLists.py
File metadata and controls
38 lines (38 loc) · 928 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
34
35
36
37
38
'''
Title : Lists
Subdomain : Data Types
Domain : Python
Author : Ahmedur Rahman Shovon
Created : 15 July 2016
'''
# Enter your code here. Read input from STDIN. Print output to STDOUT
ar=[]
n=int(input())
for i in range(0,n):
tmp_str=input()
tmp_str_ar=tmp_str.strip().split(" ")
cmd=tmp_str_ar[0]
if(cmd=="print"):
print(ar)
elif(cmd=="sort"):
ar.sort()
elif(cmd=="reverse"):
ar.reverse()
elif(cmd=="pop"):
ar.pop()
elif(cmd=="count"):
val=int(tmp_str_ar[1])
ar.count(val)
elif(cmd=="index"):
val=int(tmp_str_ar[1])
ar.index(val)
elif(cmd=="remove"):
val=int(tmp_str_ar[1])
ar.remove(val)
elif(cmd=="append"):
val=int(tmp_str_ar[1])
ar.append(val)
elif(cmd=="insert"):
pos=int(tmp_str_ar[1])
val=int(tmp_str_ar[2])
ar.insert(pos,val)