Question: # order and new _ string to hold the input _ string minus the # spaces between words, if any are found. new _ string
# order and "newstring" to hold the "inputstring" minus the
# spaces between words, if any are found.
newstring
reversestring
# Complete the for loop to iterate through each letter of the
# "inputstring"
for letter in inputstring:
# The ifstatement checks if the "letter" is not a space.
if letter :
# If True, add the "letter" to the end of "newstring" and
# to the front of "reversestring". If False if a space
# is detected no action is needed. Exit the ifblock.
newstring newstring letter
reversestring letter reversestring
# Complete the ifstatement to compare the "newstring" to the
# "reversestring". Remember that Python is casesensitive when
# creating the string comparison code.
if newstring reversestring:
# If True, the "inputstring" contains a palindrome.
return True
# therwise, return False.
return False
printispalindromeNever Odd or Even" # Should be True
printispalindromeabc # Should be False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
