Check if a string is a palindrome

 string = "racecar"

if string == string[::-1]:

    print("The string is a palindrome")

else:

    print("The string is not a palindrome")


Comments

Popular posts from this blog

Simple Python Program Code for Snake Game

Project 01: Python Code for Music Recommendation with Explanation

Iris Flowers Classification ML Project with Code