guys I know there were similar question, but pls help with this piece of code - I could find only codes to similar question but following another logic, which is not usefull to learn what I need to learn.. There is what is wanted: The is_palindrome function checks if a string is a palindrome. A palindrome is a string that can be equally read from left to right or right to left, omitting blank spaces, and ignoring capitalization. Examples of palindromes are words like kayak and radar, and phrases like "Never Odd or Even". Fill in the blanks in this function to return True if the passed string is a palindrome, False if not. and there is what I came up with.. working but missing something
def is_palindrome(input_string):
# We'll create two strings, to compare them
new_string = "{input_split}".format(input_split = input_string.lower())
reverse_string = "{input_split}".format(input_split = input_string.lower()[::-1])
# Traverse through each letter of the input string
for letter in new_string:
# Add any non-blank letters to the
# end of one string, and to the front
# of the other string.
if letter[0] in new_string != " ":
new_string = "{letter}{new_string}".format(letter = letter[0],new_string = new_string[1:])
reverse_string = "{letter}{reverse_string}".format(letter = letter[0],reverse_string = reverse_string[1:])
# Compare the strings
if new_string == reverse_string:
return True
return False
print(is_palindrome("Never Odd or Even")) # Should be True
print(is_palindrome("abc")) # Should be False
print(is_palindrome("kayak")) # Should be True