Skip to content

Commit

Permalink
Create born_on_a_friday.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Aug 4, 2019
1 parent 1f62eb3 commit cb5b85f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions born_on_a_friday.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

from datetime import datetime
from typing import Tuple


def ask_month_day_year(prompt: str = "Enter your birthday") -> Tuple[int, int, int]:
date = input(f"{prompt} in the format: MM/DD/YYYY ")
month, day, year = (int(x.strip()) for x in date.split("/"))
return month, day, year


def day_of_the_week(year, month, day):
return f"{datetime(year, month, day):%A}"


month, day, year = ask_month_day_year()
print(f"You were born on a {day_of_the_week(year, month, day)}.")

0 comments on commit cb5b85f

Please sign in to comment.