我得到错误的结果。该代码有什么问题?

时间:2019-02-22 07:34:32

标签: python-2.7

我编写了以下程序,但遇到了以下问题。即使它没有显示任何错误,但我仍然得到错误的结果(见卷)

if x == "frustum" or x == "frustum of cone":
    r1 = float(raw_input("Enter its Radius of top end (R1) :- "))
    r2 = float(raw_input("Enter its Radius of lower end (R2) :- "))
    h = float(raw_input("Enter its Height :- "))
if r1 > r2:
    R1 = r1
    R2 = r2
else:
    R1 = r2
    R2 = r1
volume = (1/3)*(22/7)*(h)*((R1*R1) + (R2*R2) + (R1*R2))

所需结果= 22.9或44.9或类似的结果
实际结果= 0.00

code with output

0 个答案:

没有答案