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
Tax preparation software can help prepare and file your taxes by _________.
OverLord2011 [107]
Tax preparation software can help prepare and file your taxes by April 15.
4 0
3 years ago
One advantage of taking photographs under fluorescent light is that: Group of answer choices
Alexus [3.1K]

They tend to be dull.

7 0
3 years ago
Explain three tests that uses for tests normality​
Volgvan

Answer:

<h2>Methods used for test of normality of data. ... [10] There are various methods available to test the normality of the continuous data, out of them, most popular methods are Shapiro–Wilk test, Kolmogorov–Smirnov test, skewness, kurtosis, histogram, box plot, P–P Plot, Q–Q Plot, and mean with SD.</h2>

Explanation:

<h2>HOPE IT HELPS YOU</h2>
7 0
2 years ago
Read 2 more answers
Interactive web designs engage a viewer using changing visual, sound, and interactive features. A great example of this was the
MrRissso [65]

Answer:

Museum of Modern Art

Explanation:

Museum of Modern Art is where many works of Art are displayed or exhibited.

An interactive web design engages a user with its user friendliness of changing visual, sound and other interactive features.

5 0
3 years ago
Why were Redditors interested in "Mister Splashy Pants"?
olganol [36]

Answer:

a

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • Which consumer document is most likely to help you if you have trouble figuring out how to operate a device
    6·1 answer
  • Put the following five steps in the order in which you would perform them to use the Paste Special function: ____. 1. Select and
    5·1 answer
  • How do I cancel my membership or Subscription on here
    11·1 answer
  • Why are high-quality transformers wound with large diameter wire?
    8·1 answer
  • What is the term for the typical layout of the keys on a keyboard?
    8·2 answers
  • Discuss copyright issues as they relate to the Internet, including software piracy and digital rights management, and the Digita
    14·1 answer
  • Please help i only have 20 minuets
    5·1 answer
  • True or False? Popular sites are always mean accurate.
    14·2 answers
  • In the 1760s and early 1770s, the British government wanted to raise money by taxing the residents of its colonies in North Amer
    8·1 answer
  • What is 4365 −3412 when these values represent
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!