Ask Question
19 July, 18:36

A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome.

Ex: If the input is:

bob

the output is:

bob is a palindrome

Ex: If the input is:

bobby

the output is:

bobby is not a palindrome

+4
Answers (1)
  1. 19 July, 22:33
    0
    string = input ()

    normal = ""

    reverse = ""

    for i in range (len (string)):

    if string[i]. isalpha ():

    normal + = string[i]. lower ()

    reverse = string[i]. lower () + reverse

    if normal = = reverse:

    print (string + " is a palindrome")

    else:

    print (string + " is not a palindrome")

    Explanation:

    Loop up to the length of string. Use an if statement to check if a certain character is an alphabet. Check if both the normal and reverse strings are equal, then display that it is a palindrome.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers