美文网首页
2018-03-09 有段代码看不懂

2018-03-09 有段代码看不懂

作者: Horus_eye | 来源:发表于2018-03-09 00:12 被阅读16次

要求:

Complete the bodies of the if-else statements in the for loop: if the key is in the dictionary langs_count, add 1 to its current value, else add the key to langs_count and set its value to 1. Use the loop variable entry in your code.

# If the language is in langs_count, add 1

    if entry in langs_count.keys():

        langs_count[entry] += 1

    # Else add the language to langs_count, set the value to 1

    else:

        langs_count[entry] = 1

相关文章

网友评论

      本文标题:2018-03-09 有段代码看不懂

      本文链接:https://www.haomeiwen.com/subject/dqiufftx.html