The following list is given:
lst = [3, 7, -10]
I want to find the maximum value of absolute value. For the above list it will be 10 (abs(-10) = 10).
I can do it as follows:
max_abs_value = lst[0]
for num in lst:
if abs(num) > max_abs_value:
max_abs_value = abs(num)
What are better ways of solving this problem?