#write a function in_list that has two parameters - list of integers and #additional number #function returns True if the number in the list and False otherwise #write a function random_list that has 4 parameters: list, size, min and #max - this function populate the list of size with random integers #between min and max #write main that randomly generates list of 10 integers, range -2 and 2 #(use function random_list to do this) #program prints the list #program will ask user to enter an integer #program will find an index of the input number in the list (first occurance), #if the number #in the list, and print error message otherwise #Example: #Random list: 1 2 1 0 -1 -2 0 1 1 2 #Additional number is 5 #Program prints 5 is not in the list #Additional number is 1 #Program prints the index of 1 is 0 import random def random_list(my_list, size, min, max): for i in range(size): my_list[i]=random.randint(min, max) #lists in Python are REFERENCE PARAMETERS #it means that function can change the list elements and changes #will be preserved def in_list(my_list, num): if(num in my_list): return True else: return False def main(): my_list=[0]*10 print("list before function random_list is called") print(my_list) #this will print 0 0 0 0 0 0 0 0 0 0 #function call random_list(my_list, 10, -2, 2) print("list AFTER function random_list is called") print(my_list) num=int(input("enter num to find its index in the list ")) if(in_list(my_list, num)==True): print("index of", num,"is", my_list.index(num)) else: print(num,"not in the list") main()