-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5program
More file actions
49 lines (41 loc) · 1.33 KB
/
5program
File metadata and controls
49 lines (41 loc) · 1.33 KB
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
39
40
41
42
43
44
45
46
47
48
49
l = []
while True:
print("given all operations:")
print("1) for create a new list operation")
print("2) for append operation")
print("3) for remove operation")
print("4) for inserting operation")
print("5) for display list")
print("6) exit operation")
choice = int(input("choose your operation: "))
if choice == 1:
l = []
x = int(input("how many elements: "))
print("enter elements:")
for i in range(x):
j = int(input())
l.append(j)
print(l)
elif choice == 2:
x = int(input("enter the number: "))
l.append(x)
print("number appended to your list")
elif choice == 3:
y = int(input("enter the number: "))
if y in l:
l.remove(y)
print("element removed")
else:
print("element not found in the list")
elif choice == 4:
z = int(input("enter the index where you want to insert: "))
a = int(input("enter the number you want to insert: "))
l.insert(z, a)
print("number inserted into the list")
elif choice == 5:
print("your list is:", l)
else:
print("exit operation.....")
break
t = tuple(l)
print("your final tuple is:", t)