Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update palindrome_soln.py #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions code/palindrome_soln.py
Expand Up @@ -30,9 +30,10 @@ def middle(word):
def is_palindrome(word):
"""Returns True if word is a palindrome."""
if len(word) <= 1:
return True
return True #this returns true if the length of the word is 0 or 1 because words might be odd or even-numbered.
#An even-numbered word, after line 37 will have a length of 0. An odd-numbered word will have a length of 1 at the final call of line 37.
if first(word) != last(word):
return False
return False #if this condition is met, line 37 will not be run, and the function will terminate.
return is_palindrome(middle(word))


Expand Down