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
Oksanka [162]
4 years ago
14

In this code, identify the repeated pattern and replace it with a function called month_days, that receives the name of the mont

h and the number of days in that month as parameters. Adapt the rest of the code so that the result is the same. Confirm your results by making a function call with the correct parameters for both months listed.

Computers and Technology
1 answer:
expeople1 [14]4 years ago
6 0

Answer:

Here is the function month_days:

def month_days(month, days):

 print (month +" has " + str(days) + " days.")

Now call this function by passing values to it as:

month_days ("June", 30)

month_days("July", 31)

The above function can also be written as:

def month_days(month, days):

 return (month +" has " + str(days) + " days.")

Now call this function by passing values to it and using print function to see the result on output screen:

print(month_days ("June", 30))

print(month_days("July", 31))

Explanation:

The above code has a function month_days which receives two arguments i.e. month which is the name of the month and days which is the number of days in that month. The method has a statement return (month +" has " + str(days) + " days.") which returns the name of the month stored in month variable followed by has word followed by the number of days stored in days variable which is followed by the word string days.

So if user passes "June" as month and 30 as days then the program has the following output:

June has 30 days.

The above program can also be written by using f-string to specify the format of the output in function month_days:

def month_days(month, days):

   output = f"{month} has {days} days."

   return (output)

Now call this function to see the output on the screen

print (month_days("June", 30))

print (month_days("July", 31))

The f-string is prefixed with 'f', which contains arguments month and days inside braces. These expressions i.e. month and days are replaced with their values specified in the calling statement.

Screenshot of the program and its output is attached.

You might be interested in
What can Marla enter into cell A11 to find out how much money is left in her budget and to make sure the cell is updated wheneve
Nookie1986 [14]
Personally I have my budget spreadsheet with all of my expenses in columns. Then I have a column showing my estimated paycheck (updating with actual# later).  Then the formula in the "Remaining" column that I use is this:    sum((A1:A99)-A100)  Where A1 through A99 (or whatever# of expenses you have) and -A100 or whatever cell name your paycheck/money is entered into - and that's all I do.  I actually have a 3 year budget, including birthdays, holidays, vacations, etc. so that you can plan ahead for any expenses and save away any extra.
8 0
3 years ago
What is an optical drive used for?​
solong [7]

Optical Disc Drive (ODD) An optical disc drive (ODD)

for using CDs, DVDs, and Blu-ray discs to listen to music or watch a movie.

Most drives also allow you to write data to a disc, so you can create your own music CDs, video DVDs or even create of back-up copy of your important data files.

dell.com

4 0
2 years ago
Read 2 more answers
Please helpppp me!! thank youuu :)
Usimov [2.4K]

Answer:

3?

Explanation:

3 0
3 years ago
A(n) _____________ is a program used to create and implement a database. operating system database management system information
Anika [276]

The program used to create and implement a database is called an operating system.

<h3>What is an operating system?</h3>

An operating system (OS) is a system that helps to manage and allocate computer resources. These computer resources are:

  • Central processing unit (CPU),
  • Computer memory,
  • File storage,
  • Input/output devices,
  • Network connections.

The most used operating system are;

  • Apple mac OS,
  • Microsoft Windows,
  • Go-ogle Android OS,
  • Lin-ux Operating System,
  • Apple iOS

Learn more about operating system:

brainly.com/question/24032221

5 0
3 years ago
Search for and list an internet websites that defines plagiarism and discusses how to avoid it
Korvikt [17]
Here are the sites that defines plagiarism and how to avoid it:
1. http://www.plagiarism.org/article/what-is-plagiarism
2. https://en.wikipedia.org/wiki/Plagiarism
3. https://writingcenter.unc.edu/tips-and-tools/plagiarism/
4. http://gethelp.library.upenn.edu/guides/engineering/ee/plagiarize.html
5. http://www.aresearchguide.com/6plagiar.html
8 0
3 years ago
Other questions:
  • The most popular input device of a computer is a(n) ____.
    6·1 answer
  • When a typist changes from a conventional typewriter to a word processor, his typing schema will have to _____ to incorporate th
    12·1 answer
  • This procedure protects against the loss of data
    5·1 answer
  • Name the six parts of the product development life cycle.
    7·2 answers
  • A ________ determines what cpus a system can use, what integrated ports the system can provide without use of third-party produc
    5·1 answer
  • Which workplace trend are outsourcing and telecommuting are examples of? Please select the best answer from the choices provided
    13·2 answers
  • The part of a rocket engine that allows the combustion gases and flames to leave the rocket engine is the
    14·1 answer
  • As a general rule, what is the size of a brochure?
    11·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    15·2 answers
  • Write a program to generate the following series 1, 3, 5, 7, 9, 11.................. 10th​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!