#Activity 3: Write a function insertNew #that has three parameters - list of integers, item to insert and the index #function inserts the item at specified index into the list #use method INSERT - see page 311 #The program is partially written for you: #Program randomly generates the list #of ints between 1 and 100 of size 10 #complete the program to ask user to enter item to insert and it's position #check if position is valid (say you have 10 elements and position is 20, then it is not valid) #print the original #list BEFORE function #call the function insertNew and print the updated list and it's new length 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 #THIS PART YOU NEED TO WRITE YOURSELF NOW: def insertNew(my_list, item, index): my_list.insert(index, item) def main(): #my_list is random list of 10 ints between 1 and 100 my_list=randomint_list(10, 1,100) item=int(input("enter the item to insert ")) index = int(input("enter the position to insert ")) if(index < len(my_list)): print("list BEFORE the function") print(my_list) print("list AFTER the function") insertNew(my_list, item, index) print(my_list) else: print("invalid index ") main()