【单选题】假设要统计一段英文每个单词出现的次数,可以使用一个字典类型 counts={},统计单词出现的次数可采用以下代码()
A. counts[word] = count[word] + 1 B. counts[word] = count.get(word,0) + 1 C. counts[word] = 1 D. C. counts[word] = count.get(word,1) + 1
A. counts[word] = count[word] + 1 B. counts[word] = count.get(word,0) + 1 C. counts[word] = 1 D. C. counts[word] = count.get(word,1) + 1
举一反三
- 若将单词保存于word中,可实现使用字典counts统计单词出现次数的代码是() A: counts[word]+=1 B: counts[word]=1 C: counts[word]=counts.get(word,1)+1 D: counts[word]=counts.get(word,0)+1
- 假设将单词保存在变量 word 中,使用一个字典类型 counts={},统计单词出现的次数可采用以下代码
- Ahyphenated word(e.g. absen-minded, flow-chart)counts as two words.
- Which of the following sentence is right in G major ? A: An open inner string counts as 2, the outer string counts as 5 B: An open inner string counts as 5, the outer string counts as 2 C: An open inner string counts as 2, the outer string counts as 6 D: An open inner string counts as 6, the outer string counts as 3
- What really ______is your attitude towards failure. A: count B: counts C: consider D: considers