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
Archy [21]
3 years ago
11

The function below takes one parameter: a string (date_string) containing a date in the mm/dd/year format. Complete the function

to return a list containing integers for each of the date components in month, day, year order. For example, if given the string '06/11/1930', your code should return the list [6, 11, 1930].
Computers and Technology
1 answer:
Natalija [7]3 years ago
8 0

Answer:

The solution code is written in Python 3.

  1. def convertDate(date_string):
  2.    date_list = date_string.split("/")
  3.    for i in range(0, len(date_list)):
  4.        date_list[i] = int(date_list[i])
  5.    return date_list  
  6. print(convertDate('06/11/1930'))

Explanation:

Firstly, create a function convertDate() with one parameter, <em>date_string</em>. (Line 1).

Next, use the Python string <em>split()</em> method to split the date string into a list of date components (month, day & year) and assign it to variable <em>date_list</em>. (Line 3) In this case, we use "/" as the separator.

However, all the separated date components in the <em>date_list</em> are still a string. We can use for-loop to traverse through each of the element within the list and convert each of them to integer using Python<em> int() </em>function. (Line 5 - 6)

At last return the final date_list as the output (Line 8)

We can test our function as in Line 11. We shall see the output is as follow:

[6, 11, 1930]

You might be interested in
Which control chart would you use to track rejections in a maintenance projeg when bug arrival pattern is not constant?
Mkey [24]

Answer:

<u>P chart</u> is the control chart that is used to monitor the rejection or acceptance whenever the bug arrival in pattern is not constant.

Explanation:

In case of only two possible outcomes, such as yes or no, accept or reject, P chart is used as control chart to track rejections. It is used to track rejections whenever the pattern of rejection is not constant. In this type of charts we collect the information from last few days to analyze and predict the next data to track rejections.

<u>For example:</u>

If we want to know that, in admission department of the university, how many students arrives to take admission in university, does not meet the qualification criteria each week. In this case there are only two options available either they meet criteria or not. In this case we use P chart with the help of previous week data to analyze the no. of students who are meeting qualification criteria in this week.

3 0
4 years ago
Yo don't take this down just join this server you can say what ever
MrMuchimi

Answer:

Stop this and watch some prawns

4 0
4 years ago
The CPU (central processing unit), also known as a processor, is considered the brain of the computer. What is the CPU’s functio
MakcuM [25]

It performs the basic arithmetical, logical, and input/output operations of a computer

4 0
3 years ago
Kesley has been hired to set up a network for a large business with ten employees. Which of the factors below will be
Ymorist [56]
The way the documents are shared
8 0
3 years ago
Which of the following descriptions about the WWW and Web 2.0 is the most accurate?
Alika [10]

Answer:

The main characteristic of web 2.0 applications is they have the ability to become better the more that people use it which means that the answer to this is letter A

6 0
4 years ago
Read 2 more answers
Other questions:
  • With a(n) ____ data table you can vary the value in one cell.
    5·1 answer
  • ___________ applications help you manage and present mathematical data easily and perfectly.
    14·1 answer
  • students at a camp can choose between boating and fishing in the morning and between hiking and horseback riding in the afternoo
    11·1 answer
  • What is one way to measure technological progress?
    5·1 answer
  • The best way for employees to improve their skills online is to enroll in a digital
    6·2 answers
  • _______ allow(s) you to apply colorful, eye catching designs to a presentation all at once.
    8·2 answers
  • To move or copy a range of cells, select the correct order:
    5·1 answer
  • To communicate with coworkers in the office
    10·1 answer
  • how do I delete my brainly account, my child signed up for it and nothing has been paid but I do not want the account to exist a
    7·2 answers
  • should variables that contain numbers always be declared as integer or floating-point data types? why or why not? name potential
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!