回答編集履歴
1
実行例を追加
test
CHANGED
@@ -4,14 +4,40 @@
|
|
4
4
|
|
5
5
|
```python
|
6
6
|
|
7
|
-
class Member:
|
7
|
+
>>> class Member:
|
8
8
|
|
9
|
-
def __init__(self, ID, Name, Place):
|
9
|
+
... def __init__(self, ID, Name, Place):
|
10
10
|
|
11
|
-
self.ID = ID
|
11
|
+
... self.ID = ID
|
12
12
|
|
13
|
-
self.Name = Name
|
13
|
+
... self.Name = Name
|
14
14
|
|
15
|
-
self.Place = Place
|
15
|
+
... self.Place = Place
|
16
|
+
|
17
|
+
...
|
18
|
+
|
19
|
+
>>> taro = Member('2dfs', '太郎', '東京')
|
20
|
+
|
21
|
+
>>> jiro = Member('52fs', '次郎', '大阪')
|
22
|
+
|
23
|
+
>>> sotaro = Member('52vs', '宗太郎', '神奈川')
|
24
|
+
|
25
|
+
>>>
|
26
|
+
|
27
|
+
>>> members = [taro, jiro, sotaro]
|
28
|
+
|
29
|
+
>>>
|
30
|
+
|
31
|
+
>>> print(members[0].ID)
|
32
|
+
|
33
|
+
2dfs
|
34
|
+
|
35
|
+
>>> print(members[0].Name)
|
36
|
+
|
37
|
+
太郎
|
38
|
+
|
39
|
+
>>> print(members[0].Place)
|
40
|
+
|
41
|
+
東京
|
16
42
|
|
17
43
|
```
|