当前位置:   article > 正文

Python输入长宽高,输出面积和体积_写一段代码,给长方体的长、宽、高分别赋值8、6、4,将矩形的体积格式化输出

写一段代码,给长方体的长、宽、高分别赋值8、6、4,将矩形的体积格式化输出
class rectangle:
    def area(long,width):
        long = long
        width = width
        print("该矩形的面积为:{}".format(long*width))

class cl(rectangle):
    def cuboid(long,width,height):
        print("该长方体的体积为:{}".format(long * width*height))

class test:
    print("请输入长方体的长:")
    long = int(input())
    print("请输入长方体的宽:")
    width = int(input())
    print("请输入长方体的高:")
    height = int(input())
    rectangle.area(long,width)
    cl.cuboid(long,width,height)

test()

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/833676
推荐阅读
相关标签
  

闽ICP备14008679号