[Quest] Python If-Else

Task
Given an integer, , 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.

Constraints

  • 1 <= n <= 100

Output Format

Print Weird if the number is weird; otherwise, print Not Weird.

Sample Input 0

3

Sample Output 0

Weird

Explanation 0

 n = 3
 n is odd and odd numbers are weird, so we print Weird.

Sample Input 1

24

Sample Output 1

Not Weird

Explanation 1

n =24
n >20 and n is even, so it isn’t weird. Thus, we print Not Weird.

閱讀全文 [Quest] Python If-Else

[Quest] Say “Hello, World!” With Python

Here is a sample line of code that can be executed in Python:

print("Hello, World!")

You can just as easily store a string as a variable and then print it to stdout:

my_string = "Hello, World!"
print(my_string)

The above code will print Hello, World! on your screen. Try it yourself in the editor below!

Input Format

You do not need to read any input in this challenge.

Output Format

Print Hello, World! to stdout.

Sample Output 0

Hello, World!

閱讀全文 [Quest] Say “Hello, World!” With Python