I'm looking to get the maximum absolute value in a random list. I need to create it in a function. I'm not sure what I'm doing wrong here. I have a for loop setup so it should check each number but it's only returning the first value.
def main():
print(maxabsinlst([-19, -3, 20, -1, 5, -25]))
def maxabsinlst(num):
for x in (num):
max_abs_value = num[5]
if abs(x) > max_abs_value:
max_abs_value = abs(x)
return max(abs(max_abs_value))
main()