Pythonで金額を硬貨に換算するプログラム - コイン計算スクリプト
st1234567890, John Doe
amount = int(input('金額を入力してください:'))
coins = [500, 100, 50, 10, 5, 1] coin_counts = []
for coin in coins: coin_count = amount // coin coin_counts.append(coin_count) amount = amount % coin
for i, coin in enumerate(coins): print(f'{coin}円{coin_counts[i]}枚')
原文地址: https://www.cveoy.top/t/topic/qENX 著作权归作者所有。请勿转载和采集!