Respuesta :
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.

The required code segment is an illustration of functions.
From the complete question, the repeated pattern is the following print statement:
print(month + " has " + str(days) + " days.")
So, the required function is as follows, where comments are used to explain each line
#This defines the function; it receives month and days as its parameters
def month_days(month,days):
#This prints the required output
print(month + " has " + str(days) + " days.")
#The function calls are as follows:
month_days("September","30")
month_days("June","30")
At the end of the program, the months and days are printed
See attachment for the complete program (without comments) and the sample run
Read more about similar programs at:
https://brainly.com/question/16953317
