Generation

generate functionMon, 28 Oct 2024

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

def is_even(n): if n % 2 == 0: if n <= 0: return False else: return True else: return False print(is_even(0)) print(is_even(1)) print(is_even(2)) print(is_even(3)) print(is_even(4)) print(is_even(5)) print(is_

Questions about programming?Chat with your personal AI assistant