【发布时间】:2014-04-01 18:20:33
【问题描述】:
伙计们。我需要编写一个程序(函数+主程序),它收集单词,将它们放入一个列表中,然后计算单词中的符号,如果符号数多于 N,则将其放入 list2。然后我需要打印出第二个列表。这是我到目前为止所得到的:
def WordsInLists(word, symbols, number):
list1 = [word]
list2 = [len.word > n]
return(list2)
list1 = []
list2 = []
howmany = int(input("How many words will you write?"))
n = int(input("What will the n number be?"))
for i in range(0, howmany, 1):
word = (input("Write the word "))
list1 = list1 + [word]
if len.word > n:
list2 = list2 + [word]
result = WordsInLists(list2)
print(result)
接下来我应该做什么或者我应该改变什么?
【问题讨论】:
-
这段代码有很多错误。我认为您应该先阅读 python 教程。
-
你的代码还没有输出它应该输出什么?这是一个很好的补充你的问题。