63 lines
613 B
Markdown
63 lines
613 B
Markdown
![]() |
---
|
||
|
id: 5e7b9f160b6c005b0e76f086
|
||
|
title: 'オブジェクト: サンプルクラス'
|
||
|
challengeType: 11
|
||
|
videoId: FiABKEuaSJ8
|
||
|
bilibiliIds:
|
||
|
aid: 589451777
|
||
|
bvid: BV1rq4y1X7TG
|
||
|
cid: 377523194
|
||
|
dashedName: objects-a-sample-class
|
||
|
---
|
||
|
|
||
|
# --question--
|
||
|
|
||
|
## --text--
|
||
|
|
||
|
次のプログラムは何を出力しますか?
|
||
|
|
||
|
```python
|
||
|
class PartyAnimal:
|
||
|
x = 0
|
||
|
def party(self):
|
||
|
self.x = self.x + 2
|
||
|
print(self.x)
|
||
|
|
||
|
an = PartyAnimal()
|
||
|
an.party()
|
||
|
an.party()
|
||
|
```
|
||
|
|
||
|
## --answers--
|
||
|
|
||
|
<pre>
|
||
|
So far 1
|
||
|
So far 2
|
||
|
</pre>
|
||
|
|
||
|
---
|
||
|
|
||
|
<pre>
|
||
|
0
|
||
|
0
|
||
|
</pre>
|
||
|
|
||
|
---
|
||
|
|
||
|
<pre>
|
||
|
2
|
||
|
2
|
||
|
</pre>
|
||
|
|
||
|
---
|
||
|
|
||
|
<pre>
|
||
|
2
|
||
|
4
|
||
|
</pre>
|
||
|
|
||
|
## --video-solution--
|
||
|
|
||
|
4
|
||
|
|