Write Test Following Function Def Maxdiff Returns Maximum Absolute Difference Adjacent Val Q43844288
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 fromt01.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
Expert Answer
Answer to Write and test the following function: def max_diff(a): “”” ——————————————————- Retu…
OR