October 2004
Intermediate to advanced
336 pages
6h 27m
English
This function, when passed a day within a year (January 1 is 1, February 1 is 32, and so on) prints the month name and day within the month.
This function takes an extra parameter to specify if the year is a leap year (where February has 29 days).
The function should raise the ValueError exception if the day number is invalid.
Remember that a class with an empty definition functions like a struct in C, allowing data to be accessed by name.
This excerpt from the Python Reference Manual helps explain one potentially confusing expression in the code:
The expression x and y first evaluates x; if x is false, its value is returned; ...
Read now
Unlock full access