Skip to content

Instantly share code, notes, and snippets.

@raeq
Last active May 17, 2020 09:51
Show Gist options
  • Save raeq/ccc9e2e83969f6e68d0b628b87cd8c2d to your computer and use it in GitHub Desktop.
Save raeq/ccc9e2e83969f6e68d0b628b87cd8c2d to your computer and use it in GitHub Desktop.
"""
A simple class example.
"""
class Book:
"""
A simple book class.
"""
def __init__(self, isbn: str, title: str, author: str):
"""
The constructor
"""
self.isbn = isbn
self.title = title
self.author = author
self.page = 0
self.notes = []
def set_note(self, note: str, page: int)-> int:
"""
Sets a reader note.
"""
self.notes.append((note, page))
def goto_page(self, page_number: int):
"""
Sets the current page number. Maximum of 1000.
"""
if page_number < 1000 > 0:
self.page = page_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment