Python Dates and Times in Python Dates and Times Far Away

Amelia Nakimuli
Amelia Nakimuli
5,743 Points

Passing a time delta as an argument

I'm not sure how to pass a time delta as an argument in a function. Pls help

far_away.py
from datetime import datetime
from datetime import timedelta

def far_away(x):
    #time_lapse = datetime.timedelta(**{time_unit: num})
    return datetime.datetime.now() + x

1 Answer

Steven Parker
Steven Parker
204,010 Points

Just "import datetime" since the code is using the module name to reference the function.