单选题 适中
#16469

执行该程序段后, 下列语句能正确输出单词"apple"出现次数的是?( ) words = ["apple", "pear", "apple", "apple"…

执行该程序段后, 下列语句能正确输出单词"apple"出现次数的是?( )

words = ["apple", "pear", "apple", "apple", "keep", "day"]
dic = {}
for i in words:
    if i in dic:
        dic[i] = dic[i] + 1
    else:
        dic[i] = 1
未登录也能判分,登录后才会记录
答案与解析
正确答案:C
解析

本题考查字典元素的访问,字典中通过指定的键,访问该键对应的值,选C