Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class apple_counter:
- def __init__(self):
- self.apple_num = 10
- def sub(self):
- self.apple_num -= 1
- def add(self):
- self.apple_num += 1
- eugen_aples = apple_counter()
- vanini_aples = apple_counter()
- print('Тваи = ', eugen_aples.apple_num, '\n',
- 'Маи = ', vanini_aples.apple_num)
- eugen_aples.sub()
- vanini_aples.add()
- eugen_aples.sub()
- vanini_aples.add()
- eugen_aples.sub()
- vanini_aples.add()
- print('Я спиздил у тебя 3 яблока, селф же обозначает, что это яблоки определенного объекта класса')
- print('Тваи = ', eugen_aples.apple_num, '\n',
- 'Маи = ', vanini_aples.apple_num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement