| Total Complexity | 1 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | def checkio(words_set): |
||
| 2 | word_list = sorted(list(words_set), key=len) |
||
| 3 | return any( |
||
| 4 | [ |
||
| 5 | word_list[i] in word_list[j][-len(word_list[i]) :] |
||
| 6 | for i in range(len(word_list)) |
||
| 7 | for j in range(i + 1, len(word_list)) |
||
| 8 | ] |
||
| 9 | ) |
||
| 10 | |||
| 11 | |||
| 12 | # These "asserts" using only for self-checking and not necessary for |
||
| 13 | # auto-testing |
||
| 14 | if __name__ == '__main__': |
||
| 15 | assert checkio({u"hello", u"lo", u"he"}) is True, "helLO" |
||
| 16 | assert checkio({u"hello", u"la", u"hellow", u"cow"}) is False, "hellow la cow" |
||
| 17 | assert checkio({u"walk", u"duckwalk"}) is True, "duck to walk" |
||
| 18 | assert checkio({u"one"}) is False, "Only One" |
||
| 19 | assert checkio({u"helicopter", u"li", u"he"}) is False, "Only end" |
||
| 20 |