Light Mode
Dark Mode
World order broken?

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: Nov. 11, 2023, 4:36 a.m.
Updated: Nov. 13, 2023, 6:36 a.m.
0
4
User avatar
bsrozhnov