Question: Write and test the following function: def max_diff(a): ------------------------------------------------------- Returns maximum absolute difference between adjacent values in a list. a must be unchanged. Use:

Write and test the following function:

def max_diff(a): """ ------------------------------------------------------- Returns maximum absolute difference between adjacent values in a list. a must be unchanged. Use: md = max_diff(a) ------------------------------------------------------- Parameters: a - a list of values (list of int) Returns: md - the largest absolute difference between adjacent values in a (int) ------------------------------------------------------- """ 

Add this function to the PyDev module functions.py. Test it from t01.py

Examples:

>>> print(max_diff([])) 0 >>> print(max_diff([0, 0, 0, 0])) 0 >>> print(max_diff([0, 1, 2, 3])) 1 >>> print(max_diff([5, 10, 20, 40])) 20 >>> print(max_diff([-5, 5, 7, 11])) 10 

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 Databases Questions!