You are viewing a single comment's thread. Return to all comments →
n = int(input())
if n % 2 == 1: print("Weird") elif n in range(2, 6): print("Not Weird") elif n in range(6, 21): print("Weird") else: print("Not Weird")
Seems like cookies are disabled on this browser, please enable them to open this website
Python If-Else
You are viewing a single comment's thread. Return to all comments →
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".
n = int(input())
if n % 2 == 1: print("Weird") elif n in range(2, 6): print("Not Weird") elif n in range(6, 21): print("Weird") else: print("Not Weird")