Created
February 19, 2018 17:36
-
-
Save nfichter/c66029eb4038229610408bb94d39e2bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date, datetime, timedelta | |
birthdays = { | |
'George Washington': date(1732, 2, 22), | |
' John Adams': date(1735, 10, 30), | |
'Thomas Jefferson': date(1743, 4, 13), | |
'James Madison': date(1751, 3, 16), | |
'James Monroe': date(1758, 4, 28), | |
'Andrew Jackson': date(1767, 3, 15), | |
'John Quincy Adams': date(1767, 7, 11), | |
'William Henry Harrison': date(1773, 2, 9), | |
'Martin Van Buren': date(1782, 12, 5), | |
'Zachary Taylor': date(1784, 11, 24), | |
' John Tyler': date(1790, 3, 29), | |
'James Buchanan': date(1791, 4, 23), | |
'James K. Polk': date(1795, 11, 2), | |
'Millard Fillmore': date(1800, 1, 7), | |
'Franklin Pierce': date(1804, 11, 23), | |
'Andrew Johnson': date(1808, 12, 29), | |
'Abraham Lincoln': date(1809, 2, 12), | |
'Ulysses S. Grant': date(1822, 4, 27), | |
'Rutherford B. Hayes': date(1822, 10, 4), | |
'Chester A. Arthur': date(1829, 10, 5), | |
'James A. Garfield': date(1831, 11, 19), | |
'Benjamin Harrison': date(1833, 8, 20), | |
'Grover Cleveland': date(1837, 3, 18), | |
'William McKinley': date(1843, 1, 29), | |
'Woodrow Wilson': date(1856, 12, 28), | |
'William H. Taft': date(1857, 9, 15), | |
'Theodore Roosevelt': date(1858, 10, 27), | |
'Warren G. Harding': date(1865, 11, 2), | |
'Calvin Coolidge': date(1872, 7, 4), | |
'Herbert Hoover': date(1874, 8, 10), | |
'Franklin D. Roosevelt': date(1882, 1, 30), | |
'Harry S. Truman': date(1884, 5, 8), | |
'Dwight D. Eisenhower': date(1890, 10, 14), | |
'Lyndon B. Johnson': date(1908, 8, 27), | |
'Ronald Reagan': date(1911, 2, 6), | |
'Richard Nixon': date(1913, 1, 9), | |
'Gerald Ford': date(1913, 7, 14), | |
'John F. Kennedy': date(1917, 5, 29), | |
'George H. W. Bush': date(1924, 6, 12), | |
'Jimmy Carter': date(1924, 10, 1), | |
'Donald Trump': date(1946, 6, 14), | |
'George W. Bush': date(1946, 7, 6), | |
'Bill Clinton': date(1946, 8, 19), | |
'Barack Obama': date(1961, 8, 4) | |
} | |
total = 0 | |
count = 0 | |
for pres in birthdays: | |
total += birthdays[pres].timetuple().tm_yday | |
count += 1 | |
print('{}\t{}\t{}\t{}'.format(pres, birthdays[pres], birthdays[pres].isoformat(), birthdays[pres].timetuple().tm_yday).expandtabs(23)) | |
average = total / count | |
print('\nAVERAGE ::: {} ::: {}'.format(average, datetime(2017, 1, 1) + timedelta(average - 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment