-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlists_switch case.py
More file actions
31 lines (28 loc) · 879 Bytes
/
lists_switch case.py
File metadata and controls
31 lines (28 loc) · 879 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
if __name__== '__main__':
print("Enter the no of commands :")
N = int(input())
list=[2,3,5,7]
print(list)
print("Start entering the commands:")
for _ in range(N):
str1=input().split()
if str1[0] == 'append':
list.append(int(str1[1]))
print(list)
elif str1[0] == 'print':
print(list)
elif str1[0] == 'sort':
list.sort()
print(list)
elif str1[0] == 'reverse':
list.reverse()
print(list)
elif str1[0] == 'pop':
list.pop()
print(list)
elif str1[0] == 'insert':
list.insert(int(str1[1]), int(str1[2]))
print(list)
elif str1[0] == 'remove':
list.remove(int(str1[1]))
print(list)