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]
3 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]3 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]3 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 can i change my age on my profile here bc i am 13 but i accidenlty put 2005 instead of 2006 no need to rush to answer just w
kykrilka [37]

Answer:

Maybe just go to personal settings and try there

Explanation:

3 0
3 years ago
Read 2 more answers
When you purchase software in a box, reading the ________ is important to know if the software will function properly?
ycow [4]
Minimal and Recommended System Requirements
6 0
3 years ago
Why should a person consider doing an apprenticeship?
dedylja [7]
There are many good things that can come out of it. There is good job training opportunities as well as learning the ways of the place. you can learn how people in that area work as well as their pace,emotions toward each-other and even lifestyles. there are many good outcomes to doing it.
5 0
3 years ago
The blue bar across the top of the screen informs you of the Screen Title, or what step you are on.
xeze [42]

Answer:

true

Explanation:

5 0
3 years ago
Can you guess why some of the nodes would still have statically assigned ip addresses?
LiRa [457]

<span>The manual assignment of an IP address to a system is called static addressing. Since the assignment of IP has been entered manually using ARP utility, the network administrators probably forgot to remove the manually configured nodes with IP addresses.  </span>

7 0
3 years ago
Other questions:
  • Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re
    14·1 answer
  • The _____ layer of the Open Systems Interconnection (OSI) model generates a receiver’s address andensures the integrity of messa
    6·1 answer
  • Answer these two if u can❤️
    5·2 answers
  • For this exercise, you are given a phrase. Return the number of time the word “dog” appears in the phrase.
    7·1 answer
  • To display a pop-up form for a control, such as account number in a datasheet create a user interface (UI) macro that is associa
    12·1 answer
  • a machine needs a minimum of 100 sec to sort 1000 names by quicksort what is the approximate worst case time needed to sort 100
    13·1 answer
  • What do we do if IOC is called on the intercom ??
    14·1 answer
  • What is the device that is non-volatile sometime called external memory?<br>​
    15·1 answer
  • Convert Fahrenheit to Celsius using this formula: F = (9/5)*C+32
    5·1 answer
  • 1. List three tabs that make up the Ribbon
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!