Question: Code in Python and use comments 4. Write one program that has the following o (15 pts, 5 for each function) Functions - Write a
Code in Python and use comments
4. Write one program that has the following o (15 pts, 5 for each function) Functions - Write a function named create list that takes in a list size and returns a list of random numbers from 1-6. i.e, calling create_list(5) should return 5 random numbers from 1- 6. (Remember, Chapter 7 has code showing how to do something similar, creating a list out of five numbers the user enters. Here, vou need to create random numbers rather than ask the user.) To test, use this code against the function you wrote my_list -create_list(5) print (my_list) And you should get output of five random elements that looks something like Write a function called count listthat takes in a list and a number. Have the functior return the number of times the specified number appears in the list. To test, use this code against the function you wrote count - count_list([1,2,3,3,3,4,2,1],3) print (count) And you should get output something like - Write a function called average_list that returns the average of the list passed into it. To test, use this code against the function you wrote avg average_list([1,2,3]) print(avg) And you should get output something like o (10 pts) Now that the functions have been created, use them all in a main program that will Create a list of 10,000 random numbers from 1 to 6. This should take one line of code Use the function you created earlier in the lab.) - Print the count of 1 through 6. (That is, print the number of times 1 appears in the 10,000. And then do the same for 2-6.) - Print the average of all 10,000 random numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
