July 22, 2023

M.Sc Python Programming Assignment 8

M.Sc Python Programming Assignments Assignment 8 Question:   To check whether a number is palindrome or not. (using recursion and without recursion). Code: def is_palindrome_recursive(word): if len(word) <= 1: return True elif word[0] != word[-1]: return False else: return is_palindrome_recursive(word[1:-1]) word = input("Enter a word: ") if is_palindrome_recursive(word): print(f"{word} is a palindrome.") else: print(f"{word} is …

M.Sc Python Programming Assignment 8 Read More »

Tech Amplifier Final Logo