01 / 07
What date is thirty days from now?
Working out "thirty days from today" yourself turns out to be surprisingly hard. Months have thirty days, or thirty-one, in no obvious order, and February has twenty-eight — twenty-nine in a leap year.
Hardly anybody can write all of that correctly on their own. So you hand it to the datetime module.
Getting the date today takes one line.
from datetime import dateprint(date.today())That one, though, gives a different answer depending on the day you run it. So that the marking can work, this lesson makes its own dates and uses those.