Palindrome Check Using String Slicing# Python program to check if a string is # palindrome or not # function to check palindrome string def isPalindrome(string): rev_string = string[::-1] return string == rev_string # Main code x = "Google" if isPalindrome(x): print(x,"is a ...
The Python code to determine whether a number is a palindrome using string slicing is as follows: def is_palindrome(num): str_num = str(num) rev_str = str_num[::-1] if str_num == rev_str: return True else: return False print(is_palindrome(121)) # True print(is_palindrome(12321...
Check Palindrome in Python Using List Slicing Example # Enter stringword=input()# Check for palindrome strings using list slicingifstr(word)==str(word)[::-1]:print("Palindrome")else:print("Not Palindrome") The program begins by prompting the user to input a string using theinput()function...