-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpy-lists.py
More file actions
26 lines (24 loc) · 730 Bytes
/
py-lists.py
File metadata and controls
26 lines (24 loc) · 730 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
if __name__ == '__main__':
n = int(input())
my_list = []
for _ in range(n):
command = input().split()
operation = command[0]
if operation == "insert":
i = int(command[1])
e = int(command[2])
my_list.insert(i, e)
elif operation == "print":
print(my_list)
elif operation == "remove":
e = int(command[1])
my_list.remove(e)
elif operation == "append":
e = int(command[1])
my_list.append(e)
elif operation == "sort":
my_list.sort()
elif operation == "pop":
my_list.pop()
elif operation == "reverse":
my_list.reverse()