Question: (e) Write a Python function called mean that takes list of numbers , numlist, as its only argument. The function should compute the average of

(e) Write a Python function called mean that takes list of numbers , numlist, as its only argument. The function should compute the average of the numbers in the list and return the result. Write a simple test program for the function. (4 marks) (1) Implement a Python function that satisfies the following specification. def prod vecs (L1, L2): V Li and L2 are lists of numbers. Function returns the element-wise product of L1 and L2 as a list. If the lists past as arguments are of different lengths, it catches the error. 17 (5 marks) Debug the Python program: import numpy as np import matplotlib.pyplot is plt x = np.linspace (0.,6*np.pi, 100 y = np.sin(x) plt.plot(x, y, g+') plt.xlabel("x in rads) plt.ylabel " sin(x) ") plt.title Plot of x vs sin(x)") plt.show() (3 marks) (h) Implement the python class represented by the class diagram below: Row one is the class name; row two are the class properties (attributes) and row three are the class methods. Position 2 init repr set_x() get_x() get_y() set_y(). get zo set_z () (7 marks 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
