i’d like to remove multiple elements from a list by user input duplicate

Here’s code you can use:

mylist =["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"]

print("do you want to remove something?")
user_input = input()
while user_input != "no":
    mylist.remove(user_input)
    for item in mylist:
        print(item, end=" ")
    print("\nanything else?")
    user_input = input()

The program keeps taking strings for removal from the user until the user says no.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top