Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
f-strings solution in Clear category for Every Person is Unique by suic
class Person:
def __init__(self, first_name, last_name, birth_date, job, working_years, salary, country, city, gender='unknown'):
self._first_name = first_name
self._last_name = last_name
self._birth_date = birth_date
self._job = job
self._working_years = working_years
self._salary = salary
self._country = country
self._city = city
self._gender = gender
def name(self):
return f"{self._first_name} {self._last_name}"
def age(self):
return 2018 - int(self._birth_date.split('.')[2]) - 1
def work(self):
gender = {
'male': 'He is a',
'female': 'She is a',
'unknown': 'Is a',
}[self._gender]
return f"{gender} {self._job}"
def money(self):
total_salary = 12 * self._working_years * self._salary
return f"{total_salary:,d}".replace(',', ' ')
def home(self):
return f"Lives in {self._city}, {self._country}"
July 11, 2018