Palindrome Check Function

  • Share this:

Code introduction


Check if a word is a palindrome (a word that reads the same forward and backward).


Technology Stack : string, math

Code Type : Function

Code Difficulty : Intermediate


                
                    
import string
import math
import os
import sys
import datetime

def generate_palindrome(word):
    def is_palindrome(s):
        return s == s[::-1]
    
    if is_palindrome(word):
        return True
    else:
        return False                
              
Tags: