
Write a function that returns how many days the month month of the year year has, and -1 when month is not a month number.
days_in_month(2024, 1)Expected result
31For your own tracking. Tests grade your code.
days_in_month(2024, 2)Expected result
29days_in_month(1900, 2)Expected result
28days_in_month(2000, 2)Expected result
29days_in_month(2024, 9)Expected result
30days_in_month(1999, 13)Expected result
-1Expected files
days_in_month.cAllowed functions
None. Write every helper yourself.

v0.40: Create exercises. Challenge the community.
Meet Studio →Write a function that returns how many days the month month of the year year has, and -1 when month is not a month number.
days_in_month(2024, 1)Expected result
31For your own tracking. Tests grade your code.
days_in_month(2024, 2)Expected result
29days_in_month(1900, 2)Expected result
28days_in_month(2000, 2)Expected result
29days_in_month(2024, 9)Expected result
30days_in_month(1999, 13)Expected result
-1Expected files
days_in_month.cAllowed functions
None. Write every helper yourself.

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.