Created
December 12, 2018 11:04
-
-
Save HemantNegi/b6721fe2568f28f928a0e472dd5d156c to your computer and use it in GitHub Desktop.
Given 3 sides of a triangle, check if triangle is possible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import os | |
import random | |
import re | |
import sys | |
# Complete the triangle function below. | |
def triangle(a, b, c): | |
if a <= 0 or b <= 0 or c <= 0: | |
return 0 | |
elif a == b == c: | |
return 1 | |
elif (a + b >= c) and (a + c >= b) and (b + c >= a): | |
return 2 | |
else: | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment