Python Anagrams 求解器

问题描述 投票:0回答:0

该程序的主要目标是写一些东西来赢得游戏 Pidgeon anagrams(是的,我知道这很可悲,但我认为它会很有趣)。游戏的工作方式是给你 6 个字母,你必须用这些字母组成单词,它相当简单,较长的单词意味着更多的分数,我觉得五个字母是最佳的,因为六个字母通常只能组成 1 个单词所以这有一个包含所有五个字母单词(低)和字母集的列表。

low = open("word_list.txt", 'r')
letters = set(['h','e','l','l','o','g',])

for line in low:
    x = line.strip()
    x = set(list(x))
    if(x.issubset(letters)):
        print(line)
#check when the code reaches the end
print("hello world")
python set anagram
© www.soinside.com 2019 - 2024. All rights reserved.