Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. class Book:
  2.     shape = 'circle'
  3.     material = 'paper'
  4.     is_paper = True
  5.  
  6.     def __init__(self, code):
  7.         self.code = code
  8.  
  9.         if code < 300:
  10.             print('*****')
  11.  
  12.  
  13. class Electronni(Book):
  14.     material = 'not paper'
  15.     waterproof = 'yeah'
  16.     wIFI = 'yeah'
  17.     is_not_paper = False
  18.     page = 1
  19.  
  20.     def __add__(self, other):
  21.         self.page += other
  22.  
  23.     def __sub__(self, other):
  24.         self.page = self.page - other
  25.  
  26.     def __str__(self):
  27.         return f'сторінка: {self.page}, code: {self.code}'
  28.  
  29.     def foo(self):
  30.         pass
  31.  
  32.  
  33.  
  34. pro = Electronni(122)
  35.  
  36.  
  37. pro + 12
  38. pro - 12
  39.  
  40.  
  41.  
  42. print(pro)
  43.  
  44.  
  45. ''.format(1, 33)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement