import math
bottom = float(input('3'))
height = float(input('4'))
hypotenuse = math.sqrt(bottom**2+height**2)
print(bottom, height, hypotenuse)
为什么运行结果是3啊,打印的结果不应该是底,高,开平方的斜边吗?为什么print的结果只有3啊,求解,感谢
错误用法,input括号里是输入的提示信息,而数值是在控制台输入的哇。你这样写没有问题,但你控制台输入数值了嘛?
import math
bottom = float(input("请输入底:"))
height = float(input("请输入高:"))
hypotenuse = math.sqrt(bottom**2+height**2)
print(bottom, height, hypotenuse)
不知道你这个问题是否已经解决, 如果还没有解决的话: