PROBLEM 60
Medium

Days in Month

Programming Basics · Python

</>
STATUS Not solved

TASK

Problem

#60

Given month number 1..12 for a non-leap year, print the number of days.

EXAMPLE

Example

Input
2
Output
28

LIMITS

Constraints

1 ≤ month ≤ 12
📖
LEARN Theory for this problem
+

`input()` reads data entered by the user. The result of `input()` is initially a string. `int()` converts a numeric string into an integer. Comparison operators `==`, `!=`, `<`, `>`, `<=`, `>=` compare values and produce `True` or `False`. `or` requires at least one condition to be true. `if` checks a condition and runs its block when the condition is true. `else` runs when the corresponding `if` condition is false. `print()` displays the program result. Print only what the problem statement requires.

**Connection to this task.** An `if` statement chooses a program branch from a Boolean condition. Comparisons produce `True` or `False`, and `elif` lets you test several mutually exclusive cases in order. The expression `28` shows how this idea is applied to the task data.

💡
NEED HELP? Hints
+

['February has 28; Apr, Jun, Sep, Nov have 30; others 31.']

ANSWER Solution
+
m = int(input())
if m == 2:
    print(28)
elif m == 4 or m == 6 or m == 9 or (m == 11):
    print(30)
else:
    print(31)