Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Task
Given an integer, , perform the following conditional actions:
Weird
Not Weird
Weird
Not Weird
Input FormatA single line containing a positive integer, .Constraints
Output FormatPrint Weird
if the number is weird; otherwise, print Not Weird
.Sample Input 0
3
Sample Output 0
Weird
Sample Input 1
24
Sample Output 1
Not Weird
ExplanationSample Case 0:
is odd and odd numbers are weird, so we print Weird
.Sample Case 1:
and is even, so it isn’t weird. Thus, we print Not Weird
.
if __name__ == '__main__':
n = int(input().strip())
if n%2!=0:
print("Weird")
else:
if n>=2 and n<=5:
print("Not Weird")
elif n>=6 and n<=20:
print("Weird")
elif n>20:
print("Not Weird")
In our experience, we suggest you solve this Python If-Else Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
Python If-Else problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get Python If-Else Hacker Rank Solution
I hope this Python If-Else Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.
This Problem is intended for audiences of all experiences who are interested in learning Programming in a business context; there are no prerequisites.
Keep Learning!
More Hacker Rank Problem & Solutions >>
Staircase Hacker Rank Solution
A Very Big Sum Hacker Rank Solution
Diagonal Difference Hacker Rank Solution