From f7d05936e2bb1b94fd72f7d13a038930f4fbb659 Mon Sep 17 00:00:00 2001 From: wanderer <19929284+AlpineBlack@users.noreply.github.com> Date: Mon, 3 Dec 2018 19:20:08 +0800 Subject: [PATCH 1/3] bugs fixed --- Maths/absMin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maths/absMin.py b/Maths/absMin.py index a353be4ceb8f..01b3ab2a5502 100644 --- a/Maths/absMin.py +++ b/Maths/absMin.py @@ -8,7 +8,7 @@ def absMin(x): """ j = absVal(x[0]) for i in x: - if absVal(i) < j: + if absVal(i) < absVal(j): j = i return j From fabb84383f7be25470a9d7484a25e69aba59b66b Mon Sep 17 00:00:00 2001 From: wanderer <19929284+AlpineBlack@users.noreply.github.com> Date: Mon, 3 Dec 2018 19:32:38 +0800 Subject: [PATCH 2/3] bugs fixed --- Maths/absMin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maths/absMin.py b/Maths/absMin.py index 01b3ab2a5502..a21413230322 100644 --- a/Maths/absMin.py +++ b/Maths/absMin.py @@ -17,4 +17,4 @@ def main(): print(absMin(a)) # = 1 if __name__ == '__main__': - main() + main() \ No newline at end of file From 7d47d8cf96d6c6689cb051daaa263d36d698c0e9 Mon Sep 17 00:00:00 2001 From: wanderer <19929284+AlpineBlack@users.noreply.github.com> Date: Mon, 3 Dec 2018 19:34:37 +0800 Subject: [PATCH 3/3] bugs fixed --- Maths/absMax.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Maths/absMax.py b/Maths/absMax.py index 432734ec02c0..dc9217ba3273 100644 --- a/Maths/absMax.py +++ b/Maths/absMax.py @@ -6,9 +6,10 @@ def absMax(x): >>absMax([3,-10,-2]) -10 """ - j = x[0] + j = absVal(x[0]) for i in x: - if absVal(i) < j: + if absVal(i) > absVal(j): + # print "at this:",i j = i return j #BUG: i is apparently a list, TypeError: '<' not supported between instances of 'list' and 'int' in absVal @@ -16,7 +17,9 @@ def absMax(x): def main(): a = [1,2,-11] - print(absVal(a)) # = -11 + print(absMax(a)) # = -11 if __name__ == '__main__': main() + +