Files

72 lines
1.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5e7b9f170b6c005b0e76f087
title: Життєвий цикл об'єкта
challengeType: 11
videoId: p1r3h_AMMIM
bilibiliIds:
aid: 461998717
bvid: BV1JL411n7Hr
cid: 377529681
dashedName: object-lifecycle
---
# --question--
## --text--
Що виведе дана програма на екран?:
```python
class PartyAnimal:
x = 0
name = ''
def __init__(self, nam):
self.name = nam
print(self.name,'constructed')
def party(self):
self.x = self.x + 1
print(self.name,'party count',self.x)
q = PartyAnimal('Quincy')
m = PartyAnimal('Miya')
q.party()
m.party()
q.party()
```
## --answers--
<pre>
Quincy constructed
Miya constructed
Quincy party count 1
Miya party count 2
Quincy party count 3
</pre>
---
<pre>
Quincy constructed
Miya constructed
Quincy party count 1
Miya party count 1
Quincy party count 2
</pre>
---
<pre>
Quincy constructed
Quincy party count 1
Quincy party count 2
Miya constructed
Miya party count 1
</pre>
## --video-solution--
2