Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Every Person is Unique by kalauroma7997
import datetime
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):
d, m, y = self.birth_date.split('.')
d1, m1, y1 = '01.01.2018'.split('.')
difference = datetime.date(int(y1), int(m1), int(d1)) - datetime.date(int(y), int(m), int(d))
return difference.days // 365
def work(self):
text = f'Is a {self.job}'
if self.gender == 'male':
text = f'He is a {self.job}'
elif self.gender == 'female':
text = f'She is a {self.job}'
return text
def money(self):
return f'{self.salary * 12 * self.working_years:,}'.replace(',', ' ')
def home(self):
return f'Lives in {self.city}, {self.country}'
Sept. 21, 2020
Comments: