Created
April 9, 2019 02:24
-
-
Save grplyler/4e693d958e147333116b2851585d0f91 to your computer and use it in GitHub Desktop.
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 Parent: | |
def __init__(self, name): | |
self.name = name | |
self.safe_open = False | |
self.armed = False | |
self.children = [] | |
def teach_children(self, topic): | |
for child in self.children: | |
child.teach(topic) | |
def have_child(self, name): | |
child = Child(name, parent) | |
self.children.append(child) | |
def open_gun_safe(self): | |
self.safe_open = True | |
self.take_gun() | |
def take_gun(self): | |
if self.safe_open: | |
self.armed = true | |
class Child(Parent): | |
def __init__(name, parent): | |
super().__init__() | |
self.parent = parent | |
self.age = 0 | |
self.mature = False | |
self.educated_on = [] | |
def grow_one_year(self) | |
self.age += 1 | |
def teach(self, topic) | |
self.educated_on.append(topic) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment