猿问

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

我们的几何老师给了我们一个作业,要求我们创建一个玩具在现实生活中何时使用几何的示例,因此我认为编写一个程序来计算填充一定数量的水池需要多少加仑水会很酷。形状,并具有一定的尺寸。注意,这是在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行中看到。它只是不会做...我在做什么错?


白衣非少年
浏览 157回答 1
1回答

陪伴而非守候

我不了解python,所以我可能是100%错误,但是在第2行上您编写了“ easygui.msgbox(”,而在第0行上则编写了“ easygui.msgbox =(”。等号与它有关系吗? ?
随时随地看视频慕课网APP

相关分类

Python
我要回答