如何制作像这样的循环3维?]

问题描述 投票:0回答:2
我试图用这样的代码制作一个小型交易摘要:

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()...
python function loops dictionary
2个回答
0
投票
您是否正在搜索类似的内容?

0
投票
您可以从price中选择一个元素,然后从buying中找到它的值并打印。
© www.soinside.com 2019 - 2024. All rights reserved.