用python 写一组类(class) 对应各种几何体(正方体,长方体,球,圆柱)的表面积和体积的编码
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/09/28 01:25:45
用python 写一组类(class) 对应各种几何体(正方体,长方体,球,圆柱)的表面积和体积的编码
class Cube:
def __init__(self,):
self.type = xxx
self.surface = xxx
不知道你要干啥,计算还是定义
再问: 分别计算正方体长方体,球,圆柱的表面积和体积
再答: 这个是计算长方体的,别的也一样,具体想做高级一点的什么自己拓展吧,很简单 #! usr/bin/python class Cube: def __init__(self,l,w,h): self.l = l self.w = w self.h = h def surface(self): result = (l*w+w*h+h*l)*2 print 'the surface of cube is '+str(result) return result def volume(self): result = l*w*h print 'the volume of cube is '+str(result) return result l = 2 w = 3 h = 4 a = Cube(l,w,h) a.surface() a.volume()
def __init__(self,):
self.type = xxx
self.surface = xxx
不知道你要干啥,计算还是定义
再问: 分别计算正方体长方体,球,圆柱的表面积和体积
再答: 这个是计算长方体的,别的也一样,具体想做高级一点的什么自己拓展吧,很简单 #! usr/bin/python class Cube: def __init__(self,l,w,h): self.l = l self.w = w self.h = h def surface(self): result = (l*w+w*h+h*l)*2 print 'the surface of cube is '+str(result) return result def volume(self): result = l*w*h print 'the volume of cube is '+str(result) return result l = 2 w = 3 h = 4 a = Cube(l,w,h) a.surface() a.volume()
用python 写一组类(class) 对应各种几何体(正方体,长方体,球,圆柱)的表面积和体积的编码
什么是长方体,正方体和圆柱的表面积
正方体、长方体、圆柱、圆柱的表面积和体积的公式是什么?
长方体、正方体、圆柱、圆锥的体积、表面积和体积公式的推导过程.
要求长方体、正方体、圆柱、圆锥的体积,长方体、正方体、圆柱的表面积
正方体、长方体、圆柱、圆锥的表面积,体积公式?
正方体的底面积和表面积和体积的公式.还有圆柱和圆锥.长方体.周长.
长方体和正方体的特征、表面积、体积
长方体正方体的表面积和体积练习
12个棱长是2厘米的正方体拼成的一个长方体,抽掉一个正方体之后的几何体,求这个几何体的表面积和体积
长方体.正方体.圆柱.长方形.正方形.圆形的表面积和体积怎样求?
12个棱长是2厘米的正方体拼成一个长方体,如图所示是抽掉一个正方体之后的几何体,求这个几何体的表面积和体积