Question

PYTHON Palindrome Checker A palindrome is a word, number, phrase, or other sequences\ of characters which...

PYTHON

Palindrome Checker
A palindrome is a word, number, phrase, or other sequences\ of characters which reads the same backward as forward.
(i.e. "racecar", "otto")

Implement a program that would take a string as an input() and returns a Boolean value (True or False) that indicates
whether the inputted string is a palindrome or not.

Example Input: "kayak"
Example Output: True

Example Input: "palindrome"
Example Output: False

Example Input: "yay yay"
Example Output: True

Example Input: "abba"
Example Output: True

Example Input: "abca"
Example Output: False

Example Input: "x"
Example Output: True

Example Input: ""
Example Output: True

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def is_palindrome(string):
    for i in range(len(string)):
        if string[i] != string[len(string) - i - 1]:
            return False
    return True


print(is_palindrome(input()))
Add a comment
Know the answer?
Add Answer to:
PYTHON Palindrome Checker A palindrome is a word, number, phrase, or other sequences\ of characters which...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT