Skip to content

Instantly share code, notes, and snippets.

@HemantNegi
Created December 12, 2018 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HemantNegi/b6721fe2568f28f928a0e472dd5d156c to your computer and use it in GitHub Desktop.
Save HemantNegi/b6721fe2568f28f928a0e472dd5d156c to your computer and use it in GitHub Desktop.
Given 3 sides of a triangle, check if triangle is possible
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