Here is my working code for this challenge. For some reason line 7 is not actually creating a set 'others' that has 'word' removed. Yet the seemingly equivalent line 8 that is commented out works just fine. What is going on here?
def checkio(words):
print('words: {}'.format(words))
for word in words:
print('checking {}'.format(word))
length = len(word)
others = words - set(word)
#others = words - {word}
print('others: {}'.format(others))
others = set(x for x in others if word in x)
if any(word == x[-length:] for x in others):
print('returning True for {}'.format(word))
return True
return False
Created at: 2018/02/18 01:05; Updated at: 2018/02/18 20:12
The question is resolved.