Skip to content

Instantly share code, notes, and snippets.

class Wizard:
def __init__(self, name, patronus, birth_year):
self.name = name
self.patronus = patronus
self.birth_year = birth_year
self.house = None
self.wand = None
# Create two wizard instances
harry = Wizard("Harry Potter", "stag", 1980)
class Wizard:
def __init__(self, name, patronus, birth_year):
self.name = name
self.patronus = patronus
self.birth_year = birth_year
self.house = None
self.wand = None
# Create two wizard instances
harry = Wizard("Harry Potter", "stag", 1980)
class Wizard:
def __init__(self, name, patronus, birth_year):
self.name = name
self.patronus = patronus
self.birth_year = birth_year
self.house = None
self.wand = None
# Create two wizard instances
harry = Wizard()
class Wizard:
def __init__(self, name, patronus, birth_year):
self.name = name
self.patronus = patronus
self.birth_year = birth_year
self.house = None
self.wand = None
class Wizard:
def __init__(self):
self.name = None
self.patronus = None
self.birth_year = None
self.house = None
self.wand = None
# Create two wizard instances
harry = Wizard()
class Wizard:
def __init__(self):
self.name = None
self.patronus = None
self.birth_year = None
self.house = None
self.wand = None
# Create two wizard instances
harry = Wizard()
class Wizard:
def __init__(self):
self.name = None
self.patronus = None
self.birth_year = None
self.house = None
self.wand = None
# Create two wizard instances
harry = Wizard()
class Wizard:
def __init__(self):
self.name = None
self.patronus = None
self.birth_year = None
self.house = None
self.wand = None
class SubstackArticle:
   def __init__(self, number_of_words):
       self.number_of_words = number_of_words
   def __mul__(self, other):
       if isinstance(other, int):
           return SubstackArticle(self.number_of_words * other)
       return NotImplemented
   def __rmul__(self, other):
class SubstackArticle:
   def __init__(self, number_of_words):
       self.number_of_words = number_of_words
   def __mul__(self, other):
       if isinstance(other, int):
           return SubstackArticle(self.number_of_words * other)
   def __rmul__(self, other):
       return self.__mul__(other)