This code works well in Python interpreter 3.10 but not in the task.
def wordsorder(text: str, words: list) -> bool:
textlist = str.split(" ")
indexes = []
for x in words:
if x in textlist:
indexes.append(textlist.index(x))
else:
return False
return indexes == sorted(indexes)
Created at: 2023/11/11 04:36; Updated at: 2023/11/13 06:36