String Palindrome Program in Python

                  

    String  Palindrome Program in Python

Examples: 

Input : malayalam
Output : Yes

Input : MSK
Output : No

Program:

    def checkPalindrome(str):
        return str == str[::-1]
     
     
    # Driver code
    s = "malayalam"
    ans = checkPalindrome(s)
     
    if ans:
        print("Palindrome")
    else:
        print("Not Palindrome")

    OutPut:
    Palindrome





























    No comments:

    Post a Comment