设计一个求直角三角形斜边长的函数(两条直角边为参数,求最长边) 如果直角边边长分分别为3和4,那么返回的结果应该像这样:

The right triangle third side's length is 5.0


def Pythagorean_theorem(a,b):
return 'The right triangle third side\'s length is {}'.format((a**2 + b**2)**(1/2))
#等价于a的平方与b的平方的1/2次方 (给斜边开根)
print(Pythagorean_theorem(3,4)) #调用函数并打印结果
 

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2022-01-10
  • 2021-08-17
  • 2021-07-09
  • 2022-12-23
  • 2021-09-07
  • 2022-01-11
猜你喜欢
  • 2021-08-26
  • 2021-10-24
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案