An even number is an integer that is exactly divisible by 2, while an odd number is an integer that is not exactly divisible by 2.
def check_odd_or_even(number):
if number % 2 == 0:
return "even"
else:
return "odd"
# Taking input for the number and checking if it's odd or even
def check_and_display_odd_even():
number = int(input("Enter a number to check if it's odd or even: "))
result = check_odd_or_even(number)
print(number, "is", result)
check_and_display_odd_even()
Enter a number to check if it's odd or even: 10
10 is even
Enter a number to check if it's odd or even: 7
7 is odd
The function check_odd_or_even(number)
checks whether a given number is odd or even.
The function check_and_display_odd_even()
takes input for the number, checks if it's odd or even using the aforementioned function, and prints the result.