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]
3 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]3 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
I WILL GIVE THE CROWN IF CORRECT
alisha [4.7K]

Answer:

foundations

Explanation:

7 0
2 years ago
Read 2 more answers
A computer program that translates a program statement by statement into machine language is called a/an?
PtichkaEL [24]
Executor. IT executes the program.
6 0
3 years ago
For each of the innovations below. Decide if it is a computing innovation or not. Part 3 Continued.
stira [4]

Explanation:

a table of the chemical elements arranged in order of atomic number, usually in rows, so that elements with similar atomic structure (and hence similar chemical properties) appear in vertical columns.

6 0
2 years ago
Please answer questions 34, 36 &amp; 37. <br><br>No explanation required. ​
kobusy [5.1K]

Answer:

36.c 37.c 34.d 35.b

Explanation:

these are the answrs

7 0
3 years ago
Many computer users, especially beginners, find ________ interfaces difficult to use.
lesya [120]

Many computer users, especially beginners, find Command Line Interfaces difficult to use.

The word Command Line will come in the blank. Other names for Command line interface (CLI) are console user interface and character user interface (CUI). It is a user interface to a computers operating system. 

4 0
3 years ago
Other questions:
  • A(n) _____________ is a simple tool that can help identify computers/devices or communication circuits that have higher-than-ave
    14·1 answer
  • To save a file so that it can be opened on most computers, select the _____ option.
    9·2 answers
  • What is the information that there are 24 hours in a day and 365 days in a year considered?
    6·2 answers
  • Seth would like to make sure as many interested customers as possible are seeing his business’s website displayed in their searc
    9·1 answer
  • "in troubleshooting a boot problem, what is the advantage of restoring all uefi/bios settings to their default values?"
    13·1 answer
  • Im on Edge 2021 and i did an assignment that says, "Processing." The assignment won't give me a grade and says it is overdue. wh
    10·1 answer
  • How can you say that a painting is real? ​
    7·2 answers
  • Which item best describes fiber optic transmission?
    14·1 answer
  • How can i setup a mesage room and also want to hangout ??????
    10·1 answer
  • Select the correct answer. Which step references adding color, size, and media format in your digital portfolio? A. identifying
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!