基本上,我必须获取一个预先存在的列表和一个百分比,然后返回一个新列表,其中包含新列表中第一个列表中给定百分比的项目。我有以下几点:
def select_stop_words(percent, list):
possible_stop_words = []
l = len(list)
new_words_list = l//(percent/100)
x = int(new_words_list - 1)
possible_stop_words = [:x]
return possible_stop_words
但这总是产生与第一个相同的结果。帮助