使用函数式编程的方式 统计一句英文短文中每个单词出现的次数。请完成填空。 txt = A computer is
已帮助 人
使用函数式编程的方式,统计一句英文短文中每个单词出现的次数。请完成填空。 txt = "A computer is a device that can be instructed to carry out an arbitrary set of arithmetic or logical operations automatically." def word_count(word_list): #词频统计 word_list.sort() words=[] for word in word_list: if word not in words: times = word_list.count(word) #计数 print("{}:{}次".format(word,times)) words.append(word) #记录已统计的单词 def func(value, ops): for function in ops: value = function(value) operators
A.[str.lower, str.split, word_count]
B.[lower, split, word_count]
C.[str.split, str.lower, word_count]
D.[split, lower, word_count]

回答
共1条回复-
C
