From 4b096142ee4bc2a103a496e87ad864bf4960753c Mon Sep 17 00:00:00 2001
From: Brady James Garvin <bgarvin@cse.unl.edu>
Date: Wed, 28 Jul 2021 21:35:18 -0500
Subject: [PATCH] Fixed bugs in the classify method.

---
 main.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/main.py b/main.py
index adcd1c8..c6d21dd 100644
--- a/main.py
+++ b/main.py
@@ -19,22 +19,22 @@ class TriangleApp(App):
     classification = StringProperty()
 
     @staticmethod
-    def classify(a, b, c):  # buggy
-        if a * b * c < 0:
+    def classify(a, b, c):
+        if a < 0 or b < 0 or c < 0:
             return Classification.INVALID
-        if a == b and b == c:
-            return Classification.EQUILATERAL
-        if a == b or b == c:
-            return Classification.ISOSCELES
+        semiperimeter = (a + b + c) / 2
         maximum = a
         if b > maximum:
             maximum = b
-            if c > maximum:
-                maximum = c
-        semiperimeter = a + b + c / 2
+        if c > maximum:
+            maximum = c
         if maximum > semiperimeter:
             return Classification.INVALID
-        if a ** 2 + b ** 2 == c ** 2 or b ** 2 + a ** 2 == c ** 2 or c ** 2 + b ** 2 == a ** 2:
+        if a == b and b == c:
+            return Classification.EQUILATERAL
+        if a == b or b == c or c == a:
+            return Classification.ISOSCELES
+        if a ** 2 + b ** 2 == c ** 2 or b ** 2 + c ** 2 == a ** 2 or c ** 2 + a ** 2 == b ** 2:
             return Classification.RIGHT
         return Classification.SCALENE
 
-- 
GitLab