-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathList_P11.py
More file actions
34 lines (34 loc) · 929 Bytes
/
List_P11.py
File metadata and controls
34 lines (34 loc) · 929 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
print("\n\t\t\tLIST")
print("\t\t\t-----")
print("1. Create")
print("2. Insert")
print("3. Remove")
print("4. Sort")
print("5. Exit")
a=[ ]
while (1):
b=int(input("\nEnter the choice:"))
if(b==1):
a=[ ]
n=int(input("Enter the number of elements:"))
for i in range(n):
e =int(input("Enter the element: "))
a.append(e)
print("\n\tList: ",a)
elif(b==2):
c=int(input("Enter the element to insert :"))
d=int(input("Enter index value :"))
a.insert(d,c)
print("\n\tList: ",a)
elif(b==3):
rem=int(input("Enter the element to remove: "))
a.remove(rem)
print("\n\tList: ",a)
elif(b==4):
a=sorted(a)
print("\n\tSorted list: ",a)
elif(b==5):
print("\n\t\tExiting....")
break
else:
print("Enter the option between 1-5")