csc-python-solutions/14/1 - The Replacements.py

6 lines
96 B
Python

def replace(l, X, Y):
while X in l:
i = l.index(X)
l.pop(i)
l.insert(i, Y)