fork download
  1. class Book:
  2. def __init__(self, title, pages=50):
  3. self.title = title
  4. self.pages = pages
  5.  
  6. class EBook:
  7. def __init__(self, title, pages=50):
  8. self.title = title
  9. self.pages = pages
  10.  
  11. def leaf_over(book : Book):
  12. for page in range(1, book.pages+1):
  13. print(book.title, "Page:", page)
  14.  
  15. B = Book("Balkan", 10)
  16. E = EBook("Expert", 3)
  17.  
  18. leaf_over(B)
  19. leaf_over(E)
Success #stdin #stdout 0.03s 9984KB
stdin
Standard input is empty
stdout
Balkan Page: 1
Balkan Page: 2
Balkan Page: 3
Balkan Page: 4
Balkan Page: 5
Balkan Page: 6
Balkan Page: 7
Balkan Page: 8
Balkan Page: 9
Balkan Page: 10
Expert Page: 1
Expert Page: 2
Expert Page: 3