2020-04-06 14:49:56 -04:00
|
|
|
---
|
|
|
|
id: 5e7b9f160b6c005b0e76f086
|
2020-04-21 23:37:02 -05:00
|
|
|
title: 'Objects: A Sample Class'
|
2020-04-06 14:49:56 -04:00
|
|
|
challengeType: 11
|
|
|
|
videoId: FiABKEuaSJ8
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: objects-a-sample-class
|
2020-04-06 14:49:56 -04:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --question--
|
|
|
|
|
|
|
|
## --text--
|
|
|
|
|
|
|
|
What will the following program print?:
|
|
|
|
|
|
|
|
```python
|
|
|
|
class PartyAnimal:
|
|
|
|
x = 0
|
|
|
|
def party(self):
|
|
|
|
self.x = self.x + 2
|
|
|
|
print(self.x)
|
|
|
|
|
|
|
|
an = PartyAnimal()
|
|
|
|
an.party()
|
|
|
|
an.party()
|
2020-04-06 14:49:56 -04:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --answers--
|
|
|
|
|
|
|
|
So far 1
|
|
|
|
|
|
|
|
So far 2
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
## --video-solution--
|
|
|
|
|
|
|
|
4
|
|
|
|
|