Question: Create a Jupyter notebook called hw1_yourlastname .ipynb where you replace yourlastname with your actual last name. After completing parts 1-3, upload your iPython notebook

Create a Jupyter notebook called hw1_yourlastname .ipynb where you replace yourlastname with 

Create a Jupyter notebook called hw1_yourlastname .ipynb where you replace yourlastname with your actual last name. After completing parts 1-3, upload your iPython notebook to Canvas. Use your iPython notebook to demon- strate that your functions work, i.e that you have tested them. Also organize your notebook using headers and text as necessary to separate the different problems. See the sample output in this Jupyter notebook. Note the last problem needs two methods from the math module. 1. Write a function take_first_n that takes a list 1 and an integer n as arguments. The function should return (as a new list) the first n values from the list. In the event that n is greater than the length of 1, the entire list should be returned. 2. Write a function mean_of_list that takes list_to_be_averaged as its argument and returns the average (mean) of that list. It should use the accumulator pattern to compute the average and return 0. if list_to_be_averaged is empty. Python has a built-in method for computing averages, but we're not using it here. This is programming practice. 3. Write a method all ones that takes a parameter v assumed to be a list of numbers and returns a list of the same length but with 1's instead of whatever values v contains. For instance, all.ones ([1,2]) would return [1,1] and all ones ([0,1,2,3]) would return [1,1,1,1].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!