mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +08:00
Some directories had a capital in their name [fixed]. Added a recursive factorial algorithm. (#763)
* Renaming directories * Adding a recursive factorial algorithm
This commit is contained in:
25
maths/absMax.py
Normal file
25
maths/absMax.py
Normal file
@ -0,0 +1,25 @@
|
||||
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
|
||||
"""
|
Reference in New Issue
Block a user