반응형
*Task*
Given an integer, N, perform the following conditional actions:
- If N is odd, print Weird
- If N is even and in the inclusive range of 2 to 5 , print Not Weird
- If N is even and in the inclusive range of 6 to 20, print Weird
- If N is even and greater than 20, print Not Weird
*Input Format*
A single line containing a positive integer, N
*Output Format*
더보기
#!/bin/python3
import math
import os
import random
import re
import sys
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");
728x90
반응형
'코딩테스트 > 해커랭크' 카테고리의 다른 글
[easy] The World of Numbers(with shell) (0) | 2022.09.29 |
---|---|
[easy]Looping with Numbers(with shell) (0) | 2022.09.29 |
[easy]A personalized Echo (with shell) (0) | 2022.09.29 |
[easy]Looping and Skipping (with Shell) (0) | 2022.09.29 |
[easy]Say "Hello, World!" With Python (0) | 2022.09.29 |