Answer:
def odd_even(N):
for number in range(0, N+1):
if number % 2 == 0:
print(str(number) + " is even")
elif number % 2 == 1:
print(str(number) +" is odd")
odd_even(5)
Step-by-step explanation:
- Create a method called odd_even that takes one parameter, N
- Initialize a for loop that iterates through 0 to N
Inside the loop, check if module of the number with respect to 2 is equal to 0. If yes, print it as even number. If module of the number with respect to 2 is equal to 1, print it as odd number
Call the method