list1 = []
len_list = int(input("Enter the number of items to enter into the list: "))
for i in range(len_list):
new = int(input("Enter the item value: "))
list1.append(new)
rem = input("Enter element(s) to be removed from list:(Seperated by spaces) ")
rem = rem.split()
for i in rem:
del list1[list1.index(int(i))]
print("Item Removed")
print(list1)
len_list = int(input("Enter the number of items to enter into the list: "))
for i in range(len_list):
new = int(input("Enter the item value: "))
list1.append(new)
rem = input("Enter element(s) to be removed from list:(Seperated by spaces) ")
rem = rem.split()
for i in rem:
del list1[list1.index(int(i))]
print("Item Removed")
print(list1)
ScreenShot:
No comments:
Post a Comment