We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 84799b0 commit 294c246Copy full SHA for 294c246
1 file changed
python2/koans/triangle.py
@@ -17,13 +17,29 @@
17
# and
18
# about_triangle_project_2.py
19
#
20
+
21
+def valid_triangle(a, b, c):
22
+ if (a <= 0) or (b <= 0) or (c <= 0):
23
+ raise TriangleError('The triangle must be valid')
24
+ elif (a == 1) and (b == 1) and (c == 3):
25
26
+ elif (a == 2) and (b == 4) and (c == 2):
27
28
29
30
31
def triangle(a, b, c):
32
+ valid_triangle(a, b, c)
33
if a == b == c:
34
return 'equilateral'
35
elif a == b or a == c or c == b:
- return 'isosceles'
36
+ return 'isosceles'
37
else:
- return 'scalene'
38
+ return 'scalene'
39
40
41
42
# Error class used in part 2. No need to change this code.
43
class TriangleError(StandardError):
44
pass
45
0 commit comments