From e48218d9e72eb193d48c2662ce1765466ba3d333 Mon Sep 17 00:00:00 2001 From: SKYFIR35 Date: Wed, 7 Oct 2026 22:18:59 +0800 Subject: [PATCH] =?UTF-8?q?for=E5=BE=AA=E7=8E=AF=E4=BD=93=E7=8E=B0?= =?UTF-8?q?=E5=A4=9A=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 陈张本-26020007010-912523257.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/陈张本-26020007010-912523257.py b/陈张本-26020007010-912523257.py index 938abc6..448db60 100644 --- a/陈张本-26020007010-912523257.py +++ b/陈张本-26020007010-912523257.py @@ -12,4 +12,10 @@ class Square(Shape): self.side = side def area(self): - return self.side * self.side \ No newline at end of file + return self.side * self.side + +r=float(input("请输入半径r:")) +side=float(input("请输入边长side:")) +shapes=[Circle(r),Square(side)] +for i in shapes: + print(i.__class__.__name__,"面积为:",i.area()) \ No newline at end of file