We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c80364 commit 3014930Copy full SHA for 3014930
Maths/absMax.py
@@ -1,5 +1,3 @@
1
-from Maths.abs import absVal
2
-
3
def absMax(x):
4
"""
5
#>>>absMax([0,5,1,11])
@@ -9,15 +7,15 @@ def absMax(x):
9
7
10
8
j =x[0]
11
for i in x:
12
- if absVal(i) > absVal(j):
+ if abs(i) > abs(j):
13
j = i
14
return j
15
- #BUG: i is apparently a list, TypeError: '<' not supported between instances of 'list' and 'int' in absVal
16
- #BUG fix
+
17
18
def main():
19
- a = [-13, 2, -11, -12]
20
- print(absMax(a)) # = -13
+ a = [1,2,-11]
+ print(absMax(a)) # = -11
21
22
if __name__ == '__main__':
23
main()
0 commit comments