answer.
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]
2 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]2 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 is an input to the Program Increment Planning process that highlights how Product Management plans to accomplish the Vision
Tatiana [17]

Answer:

Business Context

Explanation:

The input "business context" is an input to Program Increment Planning that helps understand what is the vision in Product Management.

6 0
2 years ago
Write a print statement that displays a random integer between 5 and 5000. Assume the random library is imported.
Contact [7]

Answer:

Explanation:

The following code is written in Java. It is a very simple three line statement (assuming that the random library was imported) that chooses a random integer value between 5 and 5000 and prints it to the screen using the println statement.

Random rand = new Random();

int randomNum = rand.nextInt((5000 - 5) + 1) + 5;

System.out.println(randomNum);

The random number generator is initialized and given a value between 5 and 5000. Since random number Generator will generate a number between 0 and the given value then subtracting 5 from the initial generated number makes sure that it is not more than 5000 and then adding 1 and 5 after wards makes sure that it is more than 5 always.

4 0
2 years ago
There are two cons to an OLTP database. Which of the following are a solution of these cons?​
Delicious77 [7]

Answer:

The answer is below

Explanation:

An OLTP (Online transaction processing) database is a database that allows for quick transaction processing. It involves inserting, deleting, updating data in the database.

OLTP has many drawbacks like if the system fails, all transactions are going to have problems. Also, since multiple users are allowed to access the data, it makes it prone to hackers.

The solution to the problems associated to the OLTP database is the OLAP (online analytical processing) database.

The OLAP systems allow users to analyze database information from multiple database systems at one time thereby allowing analysis for business decisions.

6 0
2 years ago
Grabar microphone audio icon_person click each item to hear a list of vocabulary words from the lesson. then, record yourself sa
Vaselesa [24]

Because this is a on your own problem, it cannot be solved. You must speak to it after the person says something.

5 0
2 years ago
Read 2 more answers
Why are smartphones and tablets capable of handling rich content and interactivity?
NikAS [45]

Answer:

Explanation:

With the advance in technology, smartphones, and tablets are built to meet the ever-increasing needs of users.

Smartphones are mobile phones that also have internet connectivity, they can be used to make calls and perform many tasks just like the conventional desktop. Smartphones and tablets are indeed considered computers because they also process inputs in form of commands and they produce outputs.

Smartphones and tablets are capable of handling rich content and interactivity because:

1. Wireless synchronization with other devices: Just like desktops, laptops, they can interact with other devices, and can receive and also send information doesn't matter the distance.

2. They have Internet connectivity.

3. They have strong hardware, good storage capacity.

4. They have inbuilt software and are capable of accepting other software and programs.

5. They are built with an appealing user interface.

6. Just as computers have processors, smartphones and tablets also have processors to ensure their speed at processing informations.

3 0
2 years ago
Other questions:
  • john wants to view sarah's assignment files on his computer. but he cannot open them because of version problems. which upgrade
    14·2 answers
  • Which of the following would be a considered a want rather than a need for most people?
    15·1 answer
  • Data is: a. Information endowed with relevance and purpose b. Set of specific objective facts or observations c. Some informatio
    10·1 answer
  • Topological sort requires only a tiny addition to the DFS algorithms. Exactly one of the following data structures is required t
    9·1 answer
  • When pasting an object which has been copied from a different slide, where on the slide does the object paste, assuming nothing
    15·1 answer
  • Complete the program below that takes in one positive, odd, integer, n (at least 3), and prints a "diamond" shape of stars with
    9·1 answer
  • HELP 30 points and Brainliest.Type the correct answer in the box. Spell all words correctly.
    11·1 answer
  • Which of the following are true statements about the data that can be represented using binary sequences?
    5·1 answer
  • Exercise 3.6.9: 24 vs. "24"5 points
    7·1 answer
  • Describe the output when the following code executes in 64-bit mode: .data dividend_hi QWORD 00000108h dividend_lo QWORD 3330002
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!