PHP前端开发

如何用python求第三条边边长

百变鹏仔 1个月前 (01-23) #Python
文章标签 边长

用python实现“已知三角形两个直角边,求斜边”

要求:用户输入两个直角边(数值为浮点类型),若非浮点类型,则提示用户,继续输入。

思路:伪代码描述下步骤

1、-input a value for the base as a float(输入某浮点数作为底边值)

立即学习“Python免费学习笔记(深入)”;

2、-input a value for the height as a float(输入某浮点数作为高的值)

3、-square root--b squared plus h squared(求平方和和开根号)

4、-save that as a float in hype,for hypotenuse(把结果存为hyp,表示斜边)

5、-print something out,using the value in hyp.(打印出结果)