题解 | #使用字典计数#
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
n = input() dict_list = {} for i in n : if i in dict_list: dict_list[i] += 1 else: dict_list[i] = 1 print(dict_list)
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
n = input() dict_list = {} for i in n : if i in dict_list: dict_list[i] += 1 else: dict_list[i] = 1 print(dict_list)
相关推荐