Solution 1

# Import the library here!
from datetime import date

def celebrate_if_friday(a_date):
    if a_date.strftime("%A") == "Friday":
        return "YES!"
    return "Aww"

Celebrate if Friday

Now that you are more familiar with formatting dates as strings, it's time to do something with that knowledge.

Make a simple function called celebrate_if_friday that checks a_date that is passed to it and sees if it is Friday. If it is, return a string that says "YES!" and return a string that says "Aww" if not.


celebrate_if_friday(date(2018, 1, 5)) # "YES!"

celebrate_if_friday(date(1987, 9, 29)) # "Aww"

Test Cases

test celebrate - Run Test

def test_celebrate():
    assert celebrate_if_friday(date(2018, 1, 5)) == "YES!"

test dont celebrate - Run Test

def test_dont_celebrate():
    assert celebrate_if_friday(date(1987, 9, 29)) == "Aww"
# Import the library here! def celebrate_if_friday(date): pass