📚 The CoCalc Library - books, templates and other resources
License: OTHER
"""This module contains a code example related to12Think Python, 2nd Edition3by Allen Downey4http://thinkpython2.com56Copyright 2015 Allen Downey78License: http://creativecommons.org/licenses/by/4.0/9"""1011from __future__ import print_function, division1213from datetime import datetime141516def main():17print("Today's date and the day of the week:")18today = datetime.today()19print(today)20print(today.strftime("%A"))2122print("Your next birthday and how far away it is:")23#s = input('Enter your birthday in mm/dd/yyyy format: ')24s = '5/11/1967'25bday = datetime.strptime(s, '%m/%d/%Y')2627next_bday = bday.replace(year=today.year)28if next_bday < today:29next_bday = next_bday.replace(year=today.year+1)30print(next_bday)3132until_next_bday = next_bday - today33print(until_next_bday)3435print("Your current age:")36last_bday = next_bday.replace(year=next_bday.year-1)37age = last_bday.year - bday.year38print(age)3940print("For people born on these dates:")41bday1 = datetime(day=11, month=5, year=1967)42bday2 = datetime(day=11, month=10, year=2003)43print(bday1)44print(bday2)4546print("Double Day is")47d1 = min(bday1, bday2)48d2 = max(bday1, bday2)49dd = d2 + (d2 - d1)50print(dd)515253if __name__ == '__main__':54main()555657