题解 | #遍历字典#

遍历字典

http://www.nowcoder.com/practice/0315639767824323a2cdb9ee3f998314

NP27 遍历字典

思路:

按照要求输入输出即可;

代码如下:

operators_dict = {'<':'less than' , '==':'equal'}
print('Here is the original dict:')
k = operators_dict.keys()
for i in sorted(k):
    print('Operator {} means {}.'.format(i,operators_dict[i]))
operators_dict['>'] = 'greater than'
print()
print('The dict was changed to:')
kk = operators_dict.keys()
for i in sorted(kk):
    print('Operator {} means {}.'.format(i,operators_dict[i]))
全部评论

相关推荐

11-17 23:00
南昌大学 Java
我要娶个什么名:10元一天 0元提成😂
点赞 评论 收藏
分享
11-07 16:07
深圳大学 运营
前端飞升:学长,阿里不是卡双非吗,我深也能去吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务