Python If-Else !! Python Programming !! Hackerrank

preview_player
Показать описание
#Python
#Hackerrank

Task
Given an integer, n , perform the following conditional actions:

1. If is odd, print Weird
2. If is even and in the inclusive range of 2 to 5 , print Not Weird
3. If is even and in the inclusive range of 6 to 20 , print Weird
4. If is even and greater than 20 , print Not Weird

Input Format

A single line containing a positive integer, n.

Constraints
n in range(1,101)

Output Format

Print Weird if the number is weird. Otherwise, print Not Weird.

Sample Input 0
3
Sample Output 0
Weird
Explanation 0
n=3
n is odd and odd numbers are weird, so print Weird.

Sample Input 1
24
Sample Output 1
Not Weird
Explanation 1
n=24
n greater than 20 and n is even, so it is not weird.
Рекомендации по теме
join shbcf.ru