From 301493094ef1638fae09c24a2fc4880812839e87 Mon Sep 17 00:00:00 2001 From: gpapadok <38889721+gpapadok@users.noreply.github.com> Date: Fri, 15 Feb 2019 18:01:10 +0200 Subject: [PATCH] Update absMax.py (#602) * Update absMax.py Fixed two bugs * changed to abs instead of absVal --- Maths/absMax.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Maths/absMax.py b/Maths/absMax.py index 2f719e32e..7ff9e4d3c 100644 --- a/Maths/absMax.py +++ b/Maths/absMax.py @@ -1,5 +1,3 @@ -from Maths.abs import absVal - def absMax(x): """ #>>>absMax([0,5,1,11]) @@ -9,15 +7,15 @@ def absMax(x): """ j =x[0] for i in x: - if absVal(i) > absVal(j): + if abs(i) > abs(j): j = i return j - #BUG: i is apparently a list, TypeError: '<' not supported between instances of 'list' and 'int' in absVal - #BUG fix + def main(): - a = [-13, 2, -11, -12] - print(absMax(a)) # = -13 + a = [1,2,-11] + print(absMax(a)) # = -11 + if __name__ == '__main__': main()