我们的几何老师给我们布置了一个作业,要求我们创建一个玩具在现实生活中使用几何的例子,所以我认为制作一个程序来计算填充一个特定形状的水池需要多少加仑的水,并且具有特定的形状是很酷的尺寸.注,这是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行所示。但它就是做不到。。。 我做错什么了?你知道吗
我不懂python,所以我可能100%错了,但是在第2行你写道易用.msgbox(" 而在第0行,你做到了”易用.msgbox=(" 等号和它有关系吗?你知道吗
相关问题 更多 >
编程相关推荐