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]
2 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]2 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
Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string
nika2105 [10]

Answer:

The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. ... Byte pair encoding is an example of a lossy transformation because it discards some of the data in the original string.

Explanation:

hope it helps!!

6 0
2 years ago
What types of issues can you most likely resolve by knowing how to access and use the control Panel?
andrezito [222]
Network issues; screen resolution and volume issues
8 0
3 years ago
Define a function typeHistogram that takes an iterator ""it"" (representing a sequence of values of different types) and builds
Alexeev081 [22]

Answer:

def typeHistogram(it,n):

   d = dict()

   for i in it:

       n -=1

       if n>=0:

           if str(type(i).__name__) not in d.keys():

               d.setdefault(type(i).__name__,1)

           else:

               d[str(type(i).__name__)] += 1

       else:

           break

   return list(d.items())

it = iter([1,2,'a','b','c',4,5])

print(typeHistogram(it,7))

Explanation:

  • Create a typeHistogram function that has 2 parameters namely "it" and "n" where "it" is an iterator used to represent a sequence of values of different types while "n" is the total number of elements in the sequence.
  • Initialize an empty dictionary and loop through the iterator "it".
  • Check if n is greater than 0 and current string is not present in the dictionary, then set default type as 1 otherwise increment by 1.
  • At the end return the list of items.
  • Finally initialize the iterator and display the histogram by calling the typeHistogram.
3 0
2 years ago
Can u please help me solve this
azamat

Alice has twice as many pencils as Cara. Leon has three more pencils than Alice. The three children have a total of 58 pencils.

<h3>What are the no. of pencils?</h3>

The no. of pencils are there totally as the 11.

Read more about the basic maths:

brainly.com/question/19493296

#SPJ1

4 0
1 year ago
#Write a function called "in_parentheses" that accepts a
zimovet [89]

Answer:

import regex as re

def in_parentheses(a_string):

   regeX = re.compile(".*?\((.*?)\)")

   result = re.findall(regeX, a_string)

   return str(result).replace("[","").replace("]","")

print("test 1: "+in_parentheses("Open ( only"))

print("test 2: "+in_parentheses("This is a sentence (words!)."))

8 0
3 years ago
Other questions:
  • Which type of network cover a large geographical area and usually consists of several smaller networks, which might use differen
    5·1 answer
  • TRUE OR FALSE, databases allow you to search for content on the internet based on certain criteria (PLS ANSWER RIGHT)
    10·2 answers
  • How to buy free big money computers that earn free money everydays?
    15·1 answer
  • Convert 578.2 into hexadecimal​
    9·1 answer
  • Assume that a function with this header: function amountSaved(price, discountRate, salesTaxRate) already exists. Write a single
    14·1 answer
  • How do you mark peoples answer as the brainliest answer? I have trouble doing so. Please help!
    10·2 answers
  • 1. Define lexemes. Give an example of an lexeme in any programming language.<br>​
    10·1 answer
  • If you have limited means, you...?
    9·1 answer
  • Write a description of the photograph to someone who cannot see the photograph. Be sure to include the title of the photograph a
    5·1 answer
  • Is it true that if the user log out the computer will turn off automatically​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!