Python If-Else !! Python Programming !! Hackerrank

Published: 12 July 2021
on channel: The HackersMap
39
2

#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.


On this page of the site you can watch the video online Python If-Else !! Python Programming !! Hackerrank with a duration of hours minute second in good quality, which was uploaded by the user The HackersMap 12 July 2021, share the link with friends and acquaintances, this video has already been watched 39 times on youtube and it was liked by 2 viewers. Enjoy your viewing!