Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Information Systems

Authors: Marshall B. Romney, Paul J. Steinbart

13th edition

133428532, 978-0133428537

More Books

Students also viewed these Computer Network questions

Question

Briefly describe each of the seven basic quality' tools.

Answered: 1 week ago