So I am trying to find a code to let you enter an amount and it will output a coin amount with the least amount of numbers (ex. 220 coins =/= 220 pennies, instead 220 coins = 2 Dollars 2 Dimes) This is the code i have so far but it seems to not like my use of modula: import math change = int(input()) dollars = change % 100 quarters = math.remainder(dollars) % 25 dimes = math.remainder(quarters) % 10 nickels = math.remainder(dimes) % 5 pennies = math.remainder(dimes) % 1 dollars_modula = dollars // 1000 if dollars == 100:     print('Dollar') elif dollars == 200 or dollars == 300 or dollars == 400 or dollars == 500 or dollars == 600 or dollars == 700 or dollars == 800 or dollars == 900 or dollars == 1000:     print('Dollar') elif dollars <= dollars_modula:     print('Dollars') elif quarters == 25:     print('Quarter')      elif quarters == 25 or quarters == 50 or quarters == 75:     print('Quarters') elif dimes == 10:     print('Dime') elif dimes == 20 or dimes == 30 or dimes == 40 or dimes == 60 or dimes == 70 or dimes == 80 or dimes == 90:     print('Dimes') elif nickels == 10:     print('Nickel') elif nickels == 15 or nickels == 35 or nickels == 45 or nickels == 65 or nickels == 85 or nickels == 95:     print('Nickels') elif change == 1:     print('Penny')      elif change == 2 or change == 3 or change == 4:     print('Pennies') else:     print('No change')

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

So I am trying to find a code to let you enter an amount and it will output a coin amount with the least amount of numbers (ex. 220 coins =/= 220 pennies, instead 220 coins = 2 Dollars 2 Dimes) This is the code i have so far but it seems to not like my use of modula:

import math

change = int(input())
dollars = change % 100
quarters = math.remainder(dollars) % 25
dimes = math.remainder(quarters) % 10
nickels = math.remainder(dimes) % 5
pennies = math.remainder(dimes) % 1
dollars_modula = dollars // 1000

if dollars == 100:
    print('Dollar')

elif dollars == 200 or dollars == 300 or dollars == 400 or dollars == 500 or dollars == 600 or dollars == 700 or dollars == 800 or dollars == 900 or dollars == 1000:
    print('Dollar')

elif dollars <= dollars_modula:
    print('Dollars')

elif quarters == 25:
    print('Quarter')
    
elif quarters == 25 or quarters == 50 or quarters == 75:
    print('Quarters')

elif dimes == 10:
    print('Dime')

elif dimes == 20 or dimes == 30 or dimes == 40 or dimes == 60 or dimes == 70 or dimes == 80 or dimes == 90:
    print('Dimes')

elif nickels == 10:
    print('Nickel')

elif nickels == 15 or nickels == 35 or nickels == 45 or nickels == 65 or nickels == 85 or nickels == 95:
    print('Nickels')

elif change == 1:
    print('Penny')
    
elif change == 2 or change == 3 or change == 4:
    print('Pennies')

else:
    print('No change')

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education