Skip to content

Instantly share code, notes, and snippets.

@jkhulme
Created February 13, 2014 12:35
Show Gist options
  • Save jkhulme/8974337 to your computer and use it in GitHub Desktop.
Save jkhulme/8974337 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
class Society(object):
def __init__(self, name):
self.name = name
self.members = []
def add_member(self, name, matric_number):
self.members.append((name, matric_number))
class Student(object):
def __init__(self, name, matric_number):
self.at_university = True
self.member_societies = {}
self.give_a_fuck = False
self.graduated = False
self.name = name
self.matric_number = matric_number
def join_society(self, society):
self.member_societies['comp_soc'] = society
society.add_member(self.name, self.matric_number)
def have_fun(self):
#TODO: Implement fun
pass
def do_work(self):
#TODO: Implement
try:
1/0
except:
self.have_fun()
def graduate(self):
self.graduated = True
self.member_societies = {}
if __name__ == "__main__":
comp_soc = Society("comp_soc")
student = Student("Jacob Essex", "s104340")
student.join_society(comp_soc)
while not student.graduated and student.member_societies.get('comp_soc', None) is not None:
if student.give_a_fuck:
student.do_work()
else:
student.have_fun()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment