Skip to content

Instantly share code, notes, and snippets.

@matmunn
Created May 6, 2019 08:43
Show Gist options
  • Save matmunn/ae5012df71d97203ca4c91e6c685dc59 to your computer and use it in GitHub Desktop.
Save matmunn/ae5012df71d97203ca4c91e6c685dc59 to your computer and use it in GitHub Desktop.
Python demo
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def say_hello(self):
"""Say hello to the user."""
print(f"Hello, {self.name}.")
class Man(Person):
gender = 'male'
class Woman(Person):
gender = 'female'
mat = Man('Mat', 28)
caitlin = Woman('Caitlin', 27)
print("Caitlin is a {}".format(caitlin.gender))
print("Mat is a {}".format(mat.gender))
mat.say_hello()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment