How to remove punctuation and capitalization in my palindrome assignment?

The problem is trying to use strings to prove whether a word or phrase is a palindrome.

def is_palindrome(input_string):

    left = 0

    right = len(input_string) - 1

    while left < right:
        if input_string[left] != input_string[right]:
            return False
        left += 1
        right -= 1
    
    return True 

This what I attempted to do but when typing in my_palindrome("race car") it was proven false when it is supposed to be proven true. Need help on finding code to add to this to make punctuation and capitalization negligible.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation