mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
93fdc9f2a1
* Travis CI: Add pytest --doctest-modules maths * Update lucas_series.py * Update lucas_series.py
24 lines
325 B
Python
24 lines
325 B
Python
from .abs import abs_val
|
|
|
|
|
|
def absMin(x):
|
|
"""
|
|
>>> absMin([0,5,1,11])
|
|
0
|
|
>>> absMin([3,-10,-2])
|
|
-2
|
|
"""
|
|
j = x[0]
|
|
for i in x:
|
|
if abs_val(i) < abs_val(j):
|
|
j = i
|
|
return j
|
|
|
|
|
|
def main():
|
|
a = [-3,-1,2,-11]
|
|
print(absMin(a)) # = -1
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main() |