質問編集履歴
2
コードの空白をなくしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,31 +6,18 @@
|
|
6
6
|
python3.7.3
|
7
7
|
コード
|
8
8
|
```class Rectangle():
|
9
|
-
|
10
|
-
|
9
|
+
def __init__(self, width, length):
|
11
|
-
|
12
|
-
|
10
|
+
self.width = width
|
13
|
-
|
14
|
-
|
11
|
+
self.length = length
|
15
|
-
|
16
|
-
|
12
|
+
def calcurate_perimeter(self):
|
17
|
-
|
18
|
-
|
13
|
+
return self.width * 2 + self.length * 2
|
19
|
-
|
20
14
|
class Square():
|
21
|
-
|
22
|
-
|
15
|
+
def __init__(self, sl):
|
23
|
-
|
24
|
-
|
16
|
+
self.sl = sl
|
25
|
-
|
26
|
-
|
17
|
+
def calculate_perimeter(self):
|
27
|
-
|
28
|
-
|
18
|
+
return self.sl * 4
|
29
|
-
|
30
|
-
|
31
19
|
a_rectangle = Rectangle(25, 50)
|
32
20
|
a_square = Square(20)
|
33
|
-
|
34
21
|
print(a_rectangle.calculate_perimeter())
|
35
22
|
|
36
23
|
Traceback (most recent call last):
|
1
エラーメッセージを書き込みました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -31,4 +31,9 @@
|
|
31
31
|
a_rectangle = Rectangle(25, 50)
|
32
32
|
a_square = Square(20)
|
33
33
|
|
34
|
-
print(a_rectangle.calculate_perimeter())
|
34
|
+
print(a_rectangle.calculate_perimeter())
|
35
|
+
|
36
|
+
Traceback (most recent call last):
|
37
|
+
File "<pyshell#34>", line 1, in <module>
|
38
|
+
print(a_rectangle.calculate_perimeter())
|
39
|
+
AttributeError: 'Rectangle' object has no attribute 'calculate_perimeter'
|