为什么我的程序不应该停止,我该如何解决这个问题呢?

时间:2013-06-06 03:08:32

标签: python variable-assignment

我们的几何老师给我们一个任务,要求我们创建一个玩具在现实生活中使用几何体的例子,所以我认为制作一个程序来计算填充池需要多少加仑的水是很酷的某种形状,具有一定的尺寸。注意,这是在python中。

到目前为止,这是该计划:

import easygui
easygui.msgbox("This program will help determine how many gallons will be needed to fill up a pool based off of the dimensions given.")
pool=easygui.buttonbox("What is the shape of the pool?",
              choices=['square/rectangle','circle'])
if pool=='circle':
    hei=easygui.enterbox("How deep is the pool?")
    radi=easygui.enterbox("What is the distance between the edge of the pool and the center of the pool (radius)?")
    areaC=3.14*(float(radi)**2) * float(hei)
    easygui.msgbox=("You need " + str(areaC) + "gallons of water to fill this pool.")

每次进入第8行(areac = 3.14 ...)时,程序似乎停止,并且不显示错误,就好像程序已经完成,而是应该显示音量如第9行所示的游泳池。虽然不会这样做...... 我做错了什么?

1 个答案:

答案 0 :(得分:2)

我不知道python,所以我可能100%错误,但在第2行你写“easygui.msgbox(” 在第0行你做“easygui.msgbox =(” 等号是否与它有关?