mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-28 07:21:07 +00:00
26 lines
309 B
Python
26 lines
309 B
Python
def absMax(x):
|
|
"""
|
|
#>>>absMax([0,5,1,11])
|
|
11
|
|
>>absMax([3,-10,-2])
|
|
-10
|
|
"""
|
|
j =x[0]
|
|
for i in x:
|
|
if abs(i) > abs(j):
|
|
j = i
|
|
return j
|
|
|
|
|
|
def main():
|
|
a = [1,2,-11]
|
|
print(absMax(a)) # = -11
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|
|
"""
|
|
print abs Max
|
|
"""
|