304 North Cardinal St.
Dorchester Center, MA 02124
Given an integer, , perform the following conditional actions:
Input FormatA single line containing a positive integer, .Constraints
Weird if the number is weird; otherwise, print
Not Weird.Sample Input 0
Sample Output 0
Sample Input 1
Sample Output 1
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
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.
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.
More Hacker Rank Problem & Solutions >>