请问Python的编写

编写Python程序

如何创建一个长方体类,输入它的长,宽和高,然后计算它的体积。

h = input("长:")
w = input("宽:")
l = input("高:")
v = int(h)*int(w)*int(l)
print("体积:" + str(v))

有用请点个采纳,嘿嘿

# -*- coding:UTF-8 -*-

class Cft:
    def __init__(self,l,w,h):
        self.l = l
        self.w = w
        self.h = h

    def volume(self):
        return self.l * self.w * self.h
        

cft = Cft(3,4,5)
s = cft.volume()
print(s)