def get_age(self, name): birthdate = self.db.get_birthdate(name) if birthdate: today = datetime.today() age = today.year - birthdate.year - ((today.month, today.day) < (birthdate.month, birthdate.day)) return age return None

from datetime import datetime

A simple web application that allows users to search for a public figure's age and receive their current age based on their birthdate.