I have to search through a list and replace all occurrences of one element with another. So far my attempts in code are getting me nowhere, what is the best way to do this?<
your_list = [1,2,1] # replace the first 1 with 11 loc = your_list.index(1) your_list.remove(1) your_list.insert(loc, 11)