#Run the following program #Pay attention on function replace #Function replace doing the following: #a. loops through the list #b. counts the number of elements divisible by 3 #c. replaces each element div by 3 with item #Function replace returns the number of replaced elements #PAY ATTENTION: FUNCTION REPLACE CHANGES THE LIST AND THE CHANGES #PRESERVED IN MAIN #IN PYTHON: Function has an ability to change the list and the changes #preserved after function is done. No need to return a new list. The old #list will be changed. import random def randomint_list(size, min_limit, max_limit): my_list=[] for i in range(size): n=random.randint(min_limit, max_limit) my_list.append(n) return my_list def replace(my_list, item): count = 0 for i in range (len(my_list)): if(my_list[i]%3 == 0): count += 1 my_list[i] = item return count def addFive(a): a = a + 5 print("in function a= ", a) def main(): #Part 1 shows you that Python function cannot change the value of #of the NOT LIST variable a = 10 print("before function a = ", a) addFive(a) print("after function a = ", a) my_list = randomint_list(10, 1, 100) print("list BEFORE function replace is called") print(my_list) count = replace(my_list, 0) print("AFTER function replace ") print(my_list) print("function replaced", count, "elements with ", 0) main()