Skip to content

Instantly share code, notes, and snippets.

@roman-on
Created April 9, 2020 16:50
Show Gist options
  • Save roman-on/51e820c736381dc5a367a228f8072fd5 to your computer and use it in GitHub Desktop.
Save roman-on/51e820c736381dc5a367a228f8072fd5 to your computer and use it in GitHub Desktop.
"""
Write a function called last_early
The function accepts as a string parameter. The function returns True if the last character that appears in the string also appears earlier. Otherwise the function returns False.
Instructions
No big or small letters are important.
# >>> last_early("happy birthday")
# True
# >>> last_early("best of luck")
# False
# >>> last_early("Wow")
# True
# >>> last_early("X")
# False
"""
def last_early(my_str):
if my_str[-1:].lower() in my_str[:-1].lower():
print("True")
else:
print("False")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment