price = {'mouse':10, 'hdd':60, 'rmd':23}
buying = {'mouse':3, 'hdd':2}
def total(price,buying):
print(sum(multiple = price.values() * buying.values()))
输出:
3 mouse : 30
2 hdd : 120
我尝试使用如下代码编写一个小型交易摘要:price = {'mouse':10,'hdd':60,'rmd':23}购买= {'mouse':3,'hdd':2 } def total(price,buying):print(sum(multiple = price.values()...
price
中选择一个元素,然后从buying
中找到它的值并打印。