o
    I*	i  ã                   @   sh   d Z dd„ Zdd„ Z	 edkr2ddlZeejd ƒZeejd	 ƒZeejd
 ƒZ	e
eeee	ƒƒ dS dS )aÛ  
This file contains the instructions and skeleton code for Part 1 of Prac 3.
This part is broken into three subtasks; you are encouraged to implement them
in the order listed:
A. the days_in_month function (8 points)
B. the day_of_year function (6 points)
C. the main program which makes use of the above (4 points)

Each part has its own test file, e.g. prac1_part1A_test.py tests part A.

Overview: you'll implement a program that calculates the day of the year
(between 1 and 366) given the year, month, and day. For example, January 1st,
2025 would be day 1 of the year 2025, while February 10th would be day 41 (31
days in January plus
10 days in Feburary).

NOTE: You may not import or use any date- or time-related modules.
c                 C   sD   |dkr| d dkrdS dS |dks|dks|dks|dkr d	S d
S )a½   Return the number of days in the given month of the year, where
    1 is January, 2 is February, and so on. The number of days follows the
    rules:
     - April (4), June (6), September (9) and November (11) have 30 days.
     - February has 28 days in a non-leap year, and 29 in a leap year.
         - Leap years are those years divisible by 4
           (there are a few exceptions in reality, but we will simplify)
     - All the rest of the months have 31 days
    Precondition: month is between 1 and 12 (inclusive).
    Examples:
    >>> days_in_month(2025, 1) # January
    31
    >>> days_in_month(2024, 11) # November
    30
    >>> days_in_month(2024, 2) # Leap year February
    29
    é   é   é    é   é   é   é	   é   é   é   © )ÚyearÚmonthr   r   úM/Users/wehrwes/Documents/2540/141/repo/lectures/L12/code/prac3/prac3_part1.pyÚdays_in_month   s    r   c                 C   s*   d}t d|ƒD ]	}|t| |ƒ7 }q|| S )aj   Return the day of the year on the given year/month/day date. For
    example, January 1st 2025 is day 1, while February 1st, 2025 is day 32.
    Precondition: the given year, month, and day form a valid date.
    Example outputs:
    >>> day_of_year(2025, 3, 1)
    60
    >>> 
    >>> day_of_year(2025, 12, 31)
    365
    >>> day_of_year(2024, 12, 31)
    366r   é   )Úranger   )r   r   ÚdayZdaysÚmr   r   r   Úday_of_year5   s   r   Ú__main__r   Nr   r   é   )Ú__doc__r   r   Ú__name__ÚsysÚintÚargvr   r   r   Úprintr   r   r   r   Ú<module>   s   ù