Advertisement
trds

Untitled

Dec 11th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. def introducere ():
  2.     t=None
  3.     a=int(input("\na="))
  4.     b=int(input("\nb="))
  5.     c=int(input("\nc="))
  6.     t(a,b,c)
  7.     return t
  8.     triunghi=introducere()
  9.     print(triunghi)
  10.  
  11. def validare(t):
  12.     if len(t)!=3:
  13.         return False
  14.     if t[0]=<0 or t[1]=<0 or t[2]=<0:
  15.         return False
  16.     if t(0)+t(t)<t(2):
  17.         return False
  18.     if t(0)+t(2)<t(1):
  19.         return False
  20.     if t(1)+t(2)<t(0):
  21.         return False
  22.     return True
  23. triunghi=citireTriunghi()
  24. v=validare(triunghi)
  25. if v==True:
  26.     print ("Este triunghi")
  27. else:
  28.     print ("Nu este triunghi")
  29.  
  30. def echilateral (t):
  31.     if t (0)==t(1) and t(1)==t(2):
  32.         return True
  33.     else:
  34.         return False
  35. def isoscel (t):
  36.     if t(0)==t(1) or t(0)==t(2) or t(2)==t(1):
  37.         return True
  38.     else:
  39.         return False
  40.  
  41. def dreptunghic (t):
  42.     if t(0)*t(0)==t(1)*t(1)+t(2)*t(2):
  43.         return True
  44.     if t(1)*(t)==t(0)**t(0)+t(2)*t(2):
  45.         return true
  46.     return False
  47.  
  48. def tip (t):
  49.     if echilateral(t)==True:
  50.         return "echilateral"
  51.     if isoscel(t)==True:
  52.         return "isoscel"
  53.     if dreptunghic(t)==True:
  54.         return "dreptunghic"
  55.     return "oarecare"
  56.     t=tip(triunghi)
  57.     print("triunghiul este {} este {}".format (triunghi,t))
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement