Computers and Technology, 19.01.2021 19:10 lovemusic4
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies.
If input is 0 or less, output is 'No Change'
For Example: Input: 45
Output:
1 Quarter
2 Dimes
input_val = int(input())
if input_val <= 0:
print('No change')
else:
num_dollars == input_val // 100
input_val %= 100
num_quarters == input_val // 25
input_val %= 25
num_dimes == input_val // 10
input_val %= 10
num_nickels == input_val // 5
input_val %= 5
num_pennies == input_val
if num_dollars > 1:
print('%d dollars' % num_dollars)
elif num_dollars ==1:
print('%d dollar' % num_dollars)
if num_quarters > 1:
print('%d quarters' % num_quarters)
elif num_quarters ==1:
print('%d quarter' % num_quarters)
if num_dimes >1:
print('%d dimes' % num_dimes)
elif num_dimes ==1:
print('%d dime' % num_dimes)
if num_nickels >1:
print('%d nickels' % num_nickels)
elif num_nickels ==1:
print('%d nickel' % num_nickels)
if num_pennies >1:
print('%d pennies' % num_pennies)
elif num_pennies ==1:
print('%d penny' % num_pennies)
Answers: 1
Computers and Technology, 23.06.2019 06:40, euniceyi56
How many nibbles can be stored in a 16-bit word?
Answers: 1
Computers and Technology, 23.06.2019 09:30, caromaybelline71
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
Computers and Technology, 23.06.2019 18:00, taiyana74
Ramona enjoys her job because she is able to kids in an after school program. the work value ramona feels strongest about is a. leadership b. risk c. independence d. work with people select the best answer from the choices provided a b c d
Answers: 1
Computers and Technology, 23.06.2019 18:00, teamroper35
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
Write a program with total change amount as an integer input, and output the change using the fewest...
Mathematics, 03.08.2020 14:01
Mathematics, 03.08.2020 14:01
Mathematics, 03.08.2020 14:01