Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def introducere() :
- t = None
- a = int(input("\na="))
- b = int(input("\nb="))
- c = int(input("\nc="))
- t = (a, b, c)
- return t
- def validare(t) :
- if len(t) != 3 :
- return False
- if t[0] <= 0 or t[1] <= 0 or t[2] <= 0 :
- return False
- if t[0] + t[1] < t[2] :
- return False
- if t[0] + t[2] < t[1] :
- return False
- if t[1] + t[2] < t[0] :
- return False
- return True
- triunghi = introducere()
- v = validare(triunghi)
- if v == True :
- print("Este triunghi")
- else :
- print("Nu este triunghi")
- def echilateral(t) :
- if t[0] == t[1] and t[1] == t[2] :
- return True
- else :
- return False
- def isoscel(t) :
- if t[0] == t[1] or t[0] == t[2] or t[2] == t[1] :
- return True
- else :
- return False
- def dreptunghic(t) :
- if t[0] * t[0] == t[1] * t[1] + t[2] * t[2] :
- return True
- if t[1] * t[1] == t[0] ** t[0] + t[2] * t[2] :
- return True
- return False
- def tip(t) :
- if echilateral(t) == True :
- return "echilateral"
- if isoscel(t) == True :
- return "isoscel"
- if dreptunghic(t) == True :
- return "dreptunghic"
- return "oarecare"
- t = tip(triunghi)
- print("triunghiul este {} este {}".format(triunghi, t))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement