Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple with str.find, fixed solution in Clear category for Goes Right After by Splitter
from re import search
def goes_after(word: str, first: str, second: str) -> bool:
return first in word and word.find(second) - word.find(first) == 1
if __name__ == '__main__':
print("Example:")
print(goes_after('world', 'w', 'o'))
# Additional checks.
assert goes_after('world', 'x', 'w') == False
assert goes_after('world', 'w', 'x') == False
# These "asserts" are used for self-checking and not for an auto-testing
assert goes_after('world', 'w', 'o') == True
assert goes_after('world', 'l', 'o') == False
assert goes_after('panorama', 'a', 'n') == True
assert goes_after('list', 'l', 'o') == False
assert goes_after('', 'l', 'o') == False
assert goes_after('list', 'l', 'l') == False
print("Coding complete? Click 'Check' to earn cool rewards!")
April 18, 2020