Understanding now.year (month, day ...) [SOLVED]


#1

I'm trying to understand when the prompt says "In the third line, we take the year (and only the year) from the variable now and store it in current_year."
Why isn't the correct code for this instruction: now = current_year From my understanding, variable = _____ .

from datetime import datetime
now = datetime.now()

current_year = now.year
current_month = now.month
current_day = now.day
print now.year
print now.month
print now.day

#2

The instruction says to

store it in current_year.

this means that current_year is your variable that you are storing your now.year into.
Hence:
current_year = now.year is correct.


#3

Thank you. I did not understand the instruction.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.