Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clean and simple (one-liner) solution in Clear category for Goes Right After by Celshade
def goes_after(word: str, first: str, second: str) -> bool:
"""Return True if the symbols occur sequentially within a word, else False.
If more than one symbol is in the word, count the first; if one of the
symbols are not in the given word, return False; if both symbols are the
same, return False; the conditions are case sensitive.
Args:
word: The word to iterate over.
first: The first symbol to search for.
second: The second symbol to search for.
"""
return first in word and word.find(second) == word.find(first) + 1
Jan. 4, 2021
Comments: