Question: Python code Complete the replace function below, which takes a list and two values as its argument. The function looks for occurrences of oldValue in
Complete the replace function below, which takes a list and two values as its argument. The function looks for occurrences of oldValue in the list, and changes each one to nevValue. For example, if numbers is the list [1, 0, 1, 1, 2, 0, 3, 1, 4], replace (numbers, 1, 9) would change numbers to (9, 0,9, 9,2, 0, 3,9, 4]. The function does not return anything; it changes the list contents directly. def replace (myList, oldValue, newValue)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
