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
Complete the stub code provided in your editor to print whether or not n is weird.
Solution
1#!/bin/python3
2
3import math
4import os
5import random
6import re
7import sys
8
9"""
10# Notes:
11
12
13if num % 2 == 0:
14 pass # Even
15else:
16 pass # Odd
17"""
18
19if __name__ == '__main__':
20 N = int(input().strip())
21
22 if N % 2 != 0: #odd
23 print("Weird")
24 elif (N % 2 == 0) and (2 <= N <= 5):
25 print("Not Weird")
26 elif (N % 2 == 0) and (6 <= N <= 20):
27 print("Weird")
28 elif (N % 2 == 0) and N >= 20:
29 print("Not Weird")