Why "now.year" not "now.year()"


#1

Hi people in the internet.
In lesson 3, why we use “now.year” not “now.year()”.
I thought we did is called a function?
And the syntax to call function sometimes don’t need parenthesis?
How can I remember these irregular exceptions?:stuck_out_tongue:


#2

Without a link to the lesson we are stymied.


#3

https://www.codecademy.com/courses/learn-python/lessons/date-and-time/exercises/extracting-information?action=lesson_resume
Hope this shows the lesson I am questioning about.


#4

year is not a function, its a class attribute which you can see here:

https://docs.python.org/2/library/datetime.html#datetime.datetime.year

once you learn about classes, methods and attributes this will be easier to remember, but you don’t have to, given that is what we have documentation for


#5

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