I want to remove a string in a nestled list
mylist = [
["School", "England", "1934"],
["House", "Germany", "1845"],
["Paris", "France", "1910"]
]
If the user types "School", "House", or "Paris" I want so that the whole line removes. I have following code:
user = input("What do you want to remove?")
counter = 0
for i in mylist:
for j in i:
if mylist[counter][0] == user:
mylist.remove(mylist[counter])
print(user + " removed!")
counter = counter + 1
Now the problem is that I can't remove the third line in mylist, just the first and the second one. I think the problem is my counter byt I am not sure.
I appreciate all the help!