Solution 1

# Import the library here!
from datetime import date

def format_date(a_date):
    return a_date.strftime("%A, %B %d %Y")

Nice Looking Date

Dates and time in Python are stored in a separate data type, the datetime object. The formatting can be a little tricky at first, so it is best to practice with it a fair amount to become familiar. Generally, you'll have the documentation handy for reference.

Datetime Documentation

For the first exercise, you'll want to import the date object from datetime library by typing from datetime import date. Then create a function called format_date that will receive a datetime object a_date and return a formatted string of the date. To do that, use the strftime method that you'll find in the documentation. Return a string of the formatted as below:

Weekday, Month Day Year


format_date(date(1987, 9, 29)) # "Tuesday, September 29 1987"

strftime info

Test Cases

test date one - Run Test

def test_date_one():
    assert format_date(date(1964, 7, 31)) == "Friday, July 31 1964"

test date two - Run Test

def test_date_two():
    assert format_date(date(1987, 9, 29)) == "Tuesday, September 29 1987"
# Import the library here! def format_date(a_date): pass