1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jenyasd209 [6]
3 years ago
13

# change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Do

llars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies
my code produces no output and i cant find why?


coin_change =int(input())

def coin_change(cents):
if cents <= 0:
print( 'Zero cents.')
else:
quarter = cents // 25
dime = (cents % 25) //10
nickle = cents % 25 % 10 // 5
penny = cents % 5



print (coin_change )
# produces no output
Computers and Technology
1 answer:
tiny-mole [99]3 years ago
3 0

Answer:

Explanation:

The Python code provided was not producing any output because you were never printing out the coin variables that you created. The following code adds the needed print statements using the right singular or plural coin name as needed.

cents = int(input())

 

def coin_change(cents):

   if cents <= 0:

       print('Zero cents.')

   else:

       quarter = cents // 25

       dime = (cents % 25) // 10

       nickle = cents % 25 % 10 // 5

       penny = cents % 5

   if quarter == 0 or quarter > 1:

       print(str(quarter) + " quarters")

   else:

       print(str(quarter) + " quarter")

   if dime == 0 or dime > 1:

       print(str(dime) + " dimes")

   else:

       print(str(dime) + " dime")

   if nickle == 0 or nickle > 1:

       print(str(nickle) + " nickels")

   else:

       print(str(nickle) + " nickel")

   if penny == 0 or penny > 1:

       print(str(penny) + " pennies")

   else:

       print(str(penny) + " penny")

coin_change(cents)

You might be interested in
Create a Python program by defining a function that calculates the year of birth of a person whose age is known to you.(You may
Alchen [17]

Answer:

  1. import datetime
  2. def get_year_of_birth():
  3.    age = int(input("Enter your age: "))  
  4.    current_year = datetime.datetime.now().year  
  5.    year_of_birth = current_year - age  
  6.    return year_of_birth  
  7. print(get_year_of_birth())

Explanation:

Firstly, we import datetime module as we need it to get the current year (Line 1).

Next, create a function named it as get_year_of_birth (Line 3). Prompt user to input age and assign it to a variable (Line 4). Next, we use now() method from datetime module to get the current date and time and extract the year component (Line 5).  At last, calculate the year of birth by subtracting the current_year with age and return it as output (Line 6-7).

3 0
3 years ago
For each of the descriptions below, perform the following tasks:
ss7ja [257]

ANSWER:

1)i. The relationship is a degree of 2 ( i.e Binary). The cardinality of the relationship is One-to-Many.

ii. The model is from piano description to piano manufacturer.

PIANO:

Model name

Model number

Serial number

Manufacturing completion date

MANUFACTURER:

Ebony and Ivory

2)i. The relationship is a degree of 2 ( i.e Binary). The cardinality of the relationship is Many-to-Many.

ii. The model is from piano description to Technician.

PIANO:

Model name

Model number

Serial number

Manufacturing completion date

TECHNICIAN

Employee number

Specialty

3)i. The relationship is a degree of 2 (i.e Binary). The cardinality of the relationship is Many-to-One.

ii. The model is from Technician to Technician

TECHNICIAN:

Lower rank

TECHNICIAN:

Higher rank

5 0
4 years ago
what is the keyboard shortcut to display formulas on the worksheet : a. CTRL+ B. CTRL+: C. CTRL+; D. ALL THE ABOVE
Orlov [11]
Girl i dont know figure it out pookie
4 0
3 years ago
Your computer sign-in screen is visible, but after you enter your sign-in credentials the computer fails to sign in and present
Step2247 [10]

Answer:

Shift key.

Explanation:

6 0
3 years ago
Can my cell phone provider keep track of my internet history?
dem82 [27]
Are they allowed to? No
Could they? Possibly
Hotel? Trivago
8 0
4 years ago
Other questions:
  • Which feature is a component of a database application?
    7·1 answer
  • In statistics, what is the mode of a data set?
    6·2 answers
  • Is the percentage of the original sample that successfully completed a survey.
    10·1 answer
  • Do anti viruses install themselves on other computers in the network
    6·1 answer
  • Free 100 point to first to answer
    5·2 answers
  • We've managed to get restricted terminal access to a hackers home server which we believe has a secret File
    11·2 answers
  • 1. Write a while loop that lets the user enter a number. The number should be multiplied by 10, and the result assigned to a var
    8·1 answer
  • Which component, located on the motherboard, carries out all the instructions provided by computer programs? ram?
    5·1 answer
  • Which century saw the development of letterpress printing?
    10·1 answer
  • The term _____ refers to an organization of components that define and regulate the collection, storage, management and use of d
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!