Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function definition, max_absolute, that takes as argument 0 or more numb

ID: 3909531 • Letter: W

Question

Write a function definition, max_absolute, that takes as argument 0 or more numbers, and returns the number with the highest absolute value.
If no numbers are specified, the function must return the Python constant None - not the string "None".

You may assume that the arguments passed to the function, if any, are all vaild numbers.
The function must be able to taken an arbitrary number of arguments.

You may test your function as follow:
max_absolute(3,100,-100,70,-2) can return either -100 or 100

The function must return a result, not print it.

Explanation / Answer

def max_absolute(*args): max_value = None for arg in args: if max_value is None or abs(max_value)
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote