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
Grace [21]
2 years ago
12

Write a function number_of_pennies() that returns the total number of pennies given a number of dollars and (optionally) a numbe

r of pennies. Ex: If you have $5.06 then the input is 5 6, and if you have $4.00 then the input is 4. Sample output with inputs: 5 6 4 506 400
Computers and Technology
2 answers:
KonstantinChe [14]2 years ago
7 0

Answer:

Code is given as:-

#number_of_pennies function with one default argument with pennies as 0 when no pennies parameter is given

def number_of_pennies(dollars,pennies = 0):

  pennies = dollars*100 + pennies #one dollar equals 100 pennies so calculate total pennies with this formula

  return pennies #return total pennies

print(number_of_pennies(int(input()),int(input()))) #both Dollars and pennies

print(number_of_pennies(int(input()))) #Dollars only

Explanation:

Here is the sample code and output.

katovenus [111]2 years ago
5 0

Answer:

The function is as follows:

def number_of_pennies(dollars,pennies=0):

   return dollars*100+pennies

   

Explanation:

This defines the function

def number_of_pennies(dollars,pennies=0):

This returns the number of pennies

   return dollars*100+pennies

<em>Note that, if the number of pennies is not passed to the function, the function takes it as 0</em>

You might be interested in
How all wheel drive works
faltersainse [42]
Yani cnm bu senin kararin istegidiin gibi davran Basarilar
8 0
3 years ago
Httpsdiscord.ggBVNuFMgG link is here<br>come and join discord​
DedPeter [7]

Answer:

httpsdiscord.ggBVNuFMgG

5 0
2 years ago
When widgets, or portable chunks of code, are embedded on html pages and thereby help increase the functionality of those pages,
Anna11 [10]
<span>When widgets, or portable chunks of code, are embedded on html pages and thereby help increase the functionality of those pages, consumers embrace one of the greatest virtues of social media known as Collaboration.</span>
5 0
3 years ago
When you save something to the Desktop on a school computer, what drive letter will it save to
Natali [406]

When you save something to the Desktop on a school computer, the drive letter it will save to the C drive.

<h3>What is a C drive?</h3>

C drive is that part of the computer that contains the operating system and files of the system. The files on which we worked are saved on the C drive of the system.

This is a type of hard drive. The work we have done on the system is automatically saved on the drive. We can easily find the C drive on the computer's file explorer. It automatically saved the data, but you can save manually the data of the D drive.

Thus, the drive letter it will save to the C drive.

To learn more about C drive, refer to the link:

brainly.com/question/2619161

#SPJ1

4 0
1 year ago
Help me out on question 29 and 30 please
Elanso [62]

Answer:

It 5

Explain

number 28 is A and number 29 is 5

5 0
2 years ago
Other questions:
  • Suppose the information content of a packet is the bit pattern 1110 0110 1001 1101 and an even parity scheme is being used. What
    15·1 answer
  • Which of the following loop conditions will read all the data in the file assuming that each line in the file contains two integ
    5·1 answer
  • _____ are special combinations of keys that tell a computer to perform a command.
    9·2 answers
  • When planning your website, what is one of the key things you should consider
    12·2 answers
  • Most operating systems perform these tasks.
    7·2 answers
  • Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
    7·2 answers
  • What is microsoft certification?
    8·1 answer
  • Write a program that takes paragraph from the user and prints all unique words in that paragraph using strings in c++
    5·1 answer
  • HELP PLSSS I WILL MARK U!!!!
    10·2 answers
  • Integrity! He talks to me of integrity! I described a circle in the air. I'd tried to build my integrity upon the role of Brothe
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!