Experiment No 04
Experiment No 04
OUTPUT:
2) Write a program to find Even or Odd
number using function
Code:
def check_even_odd(number):
if number % 2 == 0:
return "Even"
else: 4) Write a program to check if given
return "Odd" word is palindrome or not
Code:
num = int(input("Enter a number: ")) def is_palindrome(word):
word = word.lower()
result = check_even_odd(num) return word == word[::-1]
print(f"The number {num} is {result}.")
OUTPUT: word = input("Enter a word: ")
if is_palindrome(word):
print(f"The word '{word}' is a
palindrome.")
else:
print(f"The word '{word}' is not a
palindrome.")
OUTPUT: