Back to tasks
How many days has the month?
BeginnerPython for kids 路 Lesson 30: Contest tasks with conditions
Problem Statement
Read a month number (1..12), then a year. Print how many days that month has. February has 29 days in a leap year (like in lesson 26), and 28 in the others. April, June, September and November have 30 days, and the rest - 31.
Input Format
Two whole numbers: the month (1..12) and the year (1..3000), each on its own line.
Output Format
One number - the result.
Examples
Example 1
Input
2 2024
Output
29
Example 2
Input
4 2026
Output
30
Example 3
Input
1 2026
Output
31