From 7506c578afaf2eb44cae4ce9eb10496833554ad8 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Wed, 20 Sep 2023 13:59:12 +0000 Subject: [PATCH] Update 02-currency/currency.py --- 02-currency/currency.py | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/02-currency/currency.py b/02-currency/currency.py index 28fb718..bd936a0 100644 --- a/02-currency/currency.py +++ b/02-currency/currency.py @@ -1,35 +1,2 @@ -denominations_USD = [ - { 'title': 'Hundred-dollar bill', 'count': 0, 'val': 10000 }, - { 'title': 'Fifty-dollar bill', 'count': 0, 'val': 5000 }, - { 'title': 'Ten-dollar bill', 'count': 0, 'val': 1000 }, - { 'title': 'Five-dollar bill', 'count': 0, 'val': 500 }, - { 'title': 'One-dollar bill', 'count': 0, 'val': 100 }, - { 'title': 'Quarter', 'count': 0, 'val': 25 }, - { 'title': 'Dime', 'count': 0, 'val': 10 }, - { 'title': 'Nickel', 'count': 0, 'val': 5 }, - { 'title': 'penny', 'count': 0, 'val': 1 } -] - def currency_converter( amount=0, units=[] ): - amount *= 100 - - for unit in units: - while( amount != 0 and amount >= unit['val'] ): - amount -= unit['val'] - unit['count'] += 1 - - return units - -def currency_display( amount=0, units=denominations_USD ): - units = currency_converter( amount , units ) - - for unit in units: - if unit['count'] == 0: continue - - t = [ unit['count'], unit['title'], '\'s' if unit['count'] > 1 else '' ] - print( '{} {}{}'.format(*t) ) - - return None - -currency_amount = float( input('Convert: ') ) -currency_display( currency_amount ) + pass