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 game would be classified as an advergame?
Alex17521 [72]

Answer:

B. Fifa Soccer

Explanation:

That should be your answer.

8 0
3 years ago
Read 2 more answers
Alicia is typing a research paper. She is having difficulty remembering how to use the thesaurus and how to center the title. Sh
pantera1 [17]

Answer:

C. Use the help feature

Explanation:

The help feature in the MS word is the quickest access to getting real time assistance when working on a project.

7 0
4 years ago
Read 2 more answers
Given the scenario, before leaving the office, you ask the CIO to provide which formal document authorizing you to perform certa
Leona [35]

Answer:4. Authorization memo

Explanation: Authorization memo is a document that gives a go ahead to perform certain activities on the network, gives you the opportunity to work on the network on behalf of the CIO, although you are as well reminded that you are only doing this on behalf of someone, therefore advised to take precautions. Authorization memo is a reminder formal document that gives you access to do something on behalf of your CIO.

4 0
3 years ago
What was the original name of the Dream SMP?
Naddik [55]

Answer:

Dream Team SMP

Explanation:

7 0
1 year ago
Read 2 more answers
Did batman die in endgame? I dont have enough money to see the movie can you tell me what happens. It said batman died from some
kotykmax [81]

Answer: The Marvel batman, otherwise known as Iron Man did.

Explanation: Movie was pretty good.

5 0
3 years ago
Other questions:
  • Write a method so that the main() code below can be replaced by the simpler code that calls method mphandminutestomiles(). origi
    14·2 answers
  • Who is the last person appointed to the u.s supreme court
    11·1 answer
  • Which pattern is produced by the following code? for (int i = 1; i &lt;= 6; i++) { for (int j = 6; j &gt;= 1; j--) System.out.pr
    6·1 answer
  • You have just built a new system from scratch. you turn the computer on but the system boot fails and sounds a beep code. what m
    15·1 answer
  • Write a function that, given an array A of N integers, of which represents loads caused by successive processes, the function sh
    15·1 answer
  • What should be done with statements or sections which are unclear?
    12·2 answers
  • A slow response when opening applications or browsing the Internet, applications that do not work properly, an operating system
    5·2 answers
  • What factor(s) should be considered when determining whether a business is too far based on the query and the user location? Sel
    10·1 answer
  • Identify and state the value of hardware components​
    12·1 answer
  • 1. Why does a computer have different types of ports?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!