Compare commits
3 Commits
f5ef14dee8
...
ab881dd578
Author | SHA1 | Date |
---|---|---|
|
ab881dd578 | |
|
d27d5025fb | |
|
cb99c6af49 |
|
@ -1,7 +1,7 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.ERROR)
|
||||||
|
|
||||||
input_month = input('Input a month to analyse: ')
|
input_month = input('Input a month to analyse: ')
|
||||||
input_day = int(input('Input a day of that month: '))
|
input_day = int(input('Input a day of that month: '))
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
try:
|
||||||
|
user_cents = int(input('Cents: '))
|
||||||
|
except ValueError:
|
||||||
|
print('Cannot cannot parse input.')
|
||||||
|
exit()
|
||||||
|
|
||||||
|
change = []
|
||||||
|
coins = [
|
||||||
|
['Dollars', 'Dollar'],
|
||||||
|
['Quarters', 'Quarter'],
|
||||||
|
['Dimes', 'Dime'],
|
||||||
|
['Nickels', 'Nickel'],
|
||||||
|
['Pennies', 'Penny']]
|
||||||
|
|
||||||
|
while user_cents >= 100:
|
||||||
|
user_cents -= 100
|
||||||
|
change.append(coins[0])
|
||||||
|
while user_cents >= 25:
|
||||||
|
user_cents -= 25
|
||||||
|
change.append(coins[1])
|
||||||
|
while user_cents >= 10:
|
||||||
|
user_cents -= 10
|
||||||
|
change.append(coins[2])
|
||||||
|
while user_cents >= 5:
|
||||||
|
user_cents -= 5
|
||||||
|
change.append(coins[3])
|
||||||
|
for _i in range(user_cents):
|
||||||
|
change.append(coins[4])
|
||||||
|
|
||||||
|
if len(change) != 0:
|
||||||
|
for coin in coins:
|
||||||
|
num_coins = change.count(coin)
|
||||||
|
if num_coins != 0:
|
||||||
|
if num_coins > 1:
|
||||||
|
print('{0} {1}'.format(num_coins, coin[0]))
|
||||||
|
else:
|
||||||
|
print('{0} {1}'.format(num_coins, coin[1]))
|
||||||
|
else:
|
||||||
|
print('No change ')
|
||||||
|
|
Loading…
Reference in New Issue