Ad Code

Write a Python function to check whether a string is a palindrome or not.

Write a Python function to check whether a string is a palindrome or not

def is_palindrome(s):
    s = ''.join(char.lower() for char in s if char.isalnum())
    return s == s[::-1]
print(is_palindrome("level"))
print(is_palindrome("radar"))
print(is_palindrome("tenet"))
print(is_palindrome("Tanishk"))
Reactions

Post a Comment

0 Comments