题解 | #遍历字典#
遍历字典
https://www.nowcoder.com/practice/0315639767824323a2cdb9ee3f998314
这个题目描述的真是够呛,理解个半天
#Python#
def printOpKV(opDict):
opKeys= sorted(operators_dict.keys())
for k in opKeys:
print(f'Operator {k} means {operators_dict.get(k)}.')
operators_dict = {'<': 'less than', '==': 'equal'}
print('Here is the original dict:')
printOpKV(operators_dict)
operators_dict['>'] = 'greater than'
print()
print('The dict was changed to:')
printOpKV(operators_dict)
#Python#
安克创新 Anker公司福利 804人发布