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

2024-04-19 03:08:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我们的几何老师给我们布置了一个作业,要求我们创建一个玩具在现实生活中使用几何的例子,所以我认为制作一个程序来计算填充一个特定形状的水池需要多少加仑的水,并且具有特定的形状是很酷的尺寸.注,这是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行所示。但它就是做不到。。。 我做错什么了?你知道吗


Tags: oftheto程序isfillwhatwill
1条回答
网友
1楼 · 发布于 2024-04-19 03:08:07

我不懂python,所以我可能100%错了,但是在第2行你写道易用.msgbox(" 而在第0行,你做到了”易用.msgbox=(" 等号和它有关系吗?你知道吗

相关问题 更多 >