Task (题目)
Given an integer, , perform the following conditional actions:
一个特定的整数 n, 执行以下的条件行动:
If is odd, print Weird
如果 n 是奇数,打印 Weird (奇怪)
If is even and in the inclusive range of to , print Not Weird
如果 n 是偶数而且在3-5的范围,打印 Not Weird (不奇怪)
If is even and in the inclusive range of to , print Weird
如果 n 是偶数而且在6-20的范围内,打印 Weird
If is even and greater than , print Not Weird
如果 n 是偶数而且大于 20,打印 Not Weird
Input Format输入格式
A single line containing a positive integer, n.
单行但包含一个正整数,n 。
Constraints条件
n 大于或等于1,同时,n 小於或等于100
Output Format输出格式
Print Weird if the number is weird; otherwise, print Not Weird.
打印 Weird 如果数字是属于 奇怪的,否则,打印 Not Weird 。
Sample Input 0 0号例子输入
[Python] 纯文本查看复制代码
n = 3
Sample Output 0 0号例子输出
[Python] 纯文本查看复制代码
Weird
Sample Input 1 1号例子输入
[Python] 纯文本查看复制代码
n = 24
Sample Output 1 1号例子输出
[Python] 纯文本查看复制代码
Not Weird
Explanation 解释
Sample Case 0: n = 3, n is odd and odd numbers are weird, so we print Weird.
0号例子: n = 3, n 是奇数而且奇数是属于 奇怪的,所以我们打印 Weird 。
Sample Case 1: n = 24, n > 20 and n is even, so it isn't weird. Thus, we print Not Weird.
1号例子: n = 24, n 大于 20 而且 n 是偶数,所以它不属于 奇怪的。如此,我们打印 Not Weird 。
if __name__ == '__main__':
n = int(input())
if n % 2 != 0:
print("Weird")
elif n % 2 == 0 and (3 < n < 5):
print("Not Weird")
elif n % 2 == 0 and (6 < n <= 20):
print("Weird")
else:
print("Not Weird")