Mid2 21st_Remove_Number_from_List
l=[1,2,3,4,5,6,7,8,9,0]
user=int(input("Enter the number to be removed: "))
k=[]
for i in l:
if i!=user:
k.append(i)
print(k)
#output:
Enter the number to be removed: 2
[1, 3, 4, 5, 6, 7, 8, 9, 0]
l=[1,2,3,4,5,6,7,8,9,0]
Comments
Post a Comment