You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
509 B
Python
23 lines
509 B
Python
# Once upon a time...
|
|
|
|
class Vampire:
|
|
def __init__(self, props):
|
|
self.location = props['location']
|
|
self.birthDate = props['birthDate']
|
|
self.deathDate = props['deathDate']
|
|
self.weaknesses = props['weaknesses']
|
|
|
|
def get_age(self):
|
|
return self.calc_age()
|
|
|
|
def calc_age(self):
|
|
return self.deathDate - self.birthDate
|
|
|
|
# ...there was a guy named Vlad
|
|
|
|
Dracula = Vampire({
|
|
'location': 'Transylvania',
|
|
'birthDate': 1428,
|
|
'deathDate': 1476,
|
|
'weaknesses': ['Sunlight', 'Garlic']
|
|
}) |