To FCX

Table of Contents

def exam(a, b, c):
  print(f"a={a}, b={b}, c={c}")
  if a == b == c:
    print("等边三角形")
  elif a**2 + b**2 == c**2 or a**2 + c**2 == b**2 or b**2 + c**2 == a**2:
     print("直角三角形")
  elif (a+b>c and a+c>b and b+c>a):
     print("普通三角形")
  elif a+b<=c or a+c<=b or b+c <=a:
     print("无法构成三角形")
  else:
     print("不知道")

  print("-"*40)

if __name__ == '__main__':
  a, b, c = 3, 4, 5
  exam(a, b, c)
  a, b, c = 3, 3, 3
  exam(a, b, c)
  a, b, c = 3, 8, 8
  exam(a, b, c)
  a, b, c = 3, 3, 8
  exam(a, b, c)

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: 似水流年