Hello I'm new coding and I have one doubt about a problem that ask me to compare an input string and define if is a palindrome or not. I've read about some answers but I'm not sure why they use some parts. In this code:
def is_palindrome(input_string):
ns = ""
rv = ""
input_string =input_string.lower()
for x in input_string:
**if x!=" ":**
ns =ns+ x
rs = x+rs
# Compare the strings
if ns==rs:
return True
return False
The part of the code that is if x!=" ": is the part I don't get it. I understand that the for loop allow us to place us in each letter of the input script but if it's a space the character in the script what happen?