我需要了解为什么这个程序没有产生任何输出

时间:2018-09-27 00:43:26

标签: python-3.x debugging

all_words = sorted(
    set([word.strip().lower() for word in open("/home/jermaine/cs3180cl/words.txt").readlines() if len(word) == 7]))


def is_anagram(one, two):
    if len(one) != len(two):
        return False

    result = 0

    for i in one:
        result ^= ord(i)

    for j in two:
        result ^= ord(j)

    if result != 0:
        return False

    return True


def find_words(words):
    all_letters = "".join(words)
    anagrams = []
    for i in all_words:
        if is_anagram(all_letters, i):
            anagrams = i
        continue
    print('%s' % ', '.join(map(str, anagrams)))


find_words("zomomin" "am")

0 个答案:

没有答案