This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Wizard: | |
def __init__(self): | |
self.name = None | |
self.patronus = None | |
self.birth_year = None | |
self.house = None | |
self.wand = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder