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

6 lines
96 B
Python
Raw Normal View History

2021-02-18 07:23:30 +00:00
def replace(l, X, Y):
while X in l:
i = l.index(X)
l.pop(i)
l.insert(i, Y)