问题描述
我是Python新手,需要一些帮助。我试图一次拿出10个混乱的单词并让程序解读它们然后将它们打印出来,如:word1,word2,word3等。
到目前为止,代码将解读的不仅仅是一次一个单词,但如果单词中有多个相同的字母,它会多次打印答案,并将它们打印在一列中。例子是inwdwo和garnama(窗口字谜)。会像这样打印出来:
窗口
窗口
anagram
anagram
anagram。
我读到一套可以帮助这个,但我不知道该放在哪里或如何获得%s,%s,%s类型的打印输出。任何帮助?
Hi, I''m new to Python and need some help with this program. I''m trying to take 10 jumbled words at a time and have the program unscramble them and then print them out like: word1,word2,word3, etc.
So far the code will unscramble more than one word at once but it will print the answer several times if there is more than 1 of the same letter in the word and it will print them in a column. Example is inwdwo and garnama (window anagram). It will print them like this:
window
window
anagram
anagram
anagram.
I read that a set can help this but I''m not sure where to put that or how to get the %s,%s,%s type of print out. Any help?
推荐答案
这篇关于为新手帮助word unscrambler代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!