第11864题 单选题
贪心硬币找零问题Python程序补全,横线处应填入哪项代码

一名收银员给顾客找零,目标是凑出指定金额的同时使用尽可能少的硬币,现有硬币面额为1分、5分、10分、25分,补全如下Python程序横线处的代码:

def coin_change(amount, coins):
    result = []
    for coin in sorted(coins, reverse=True):
        while amount >= coin:
            ___________________
            result.append(coin)
    return result
coins = [1, 5, 10, 25]
amount = 63
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析