您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页2018-03-09 有段代码看不懂

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

来源:华佗小知识

要求:

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

Copyright © 2019- huatuo0.cn 版权所有 湘ICP备2023017654号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务