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]
2 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]2 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
I love dog my is 16 weeks old how old is yours
attashe74 [19]
I don't like dogs so I don't have one but if I did I think it would have been dead anyway
5 0
2 years ago
Information is best described as
Viefleur [7K]

Answer: Option B

Explanation: Information can be defined as the presentation of scattered data in a sequential manner to make it more meaningful and understanding.

Information is the exchange of intelligence, thus, it has to be organized and processed from its raw form.

From the above explanation we can conclude that the right option is B.

7 0
3 years ago
Which of the following statements about Java Class Libraries is false: a. Java class libraries consist of classes that consist o
blondinia [14]

Answer:

Statement D is false

D. Java class libraries are not portable = FALSE

Explanation:

Because java class library are portable and JVM (java virtual machine) makes java class library and other java codes portable and platform independent and JVM act as a OS or imaginary CPU for that code.

8 0
3 years ago
What is the autocad term for standard section line symbols?
seraphim [82]
I think the answer is hatch pattern.
8 0
3 years ago
Is backing up computer files done on the hard drive?
melomori [17]
Yes I believe so 

It should be acked up on the hard drive
7 0
3 years ago
Other questions:
  • Where does the term for a star network describe? A) a network for Department of Defense scientists to share data about the stars
    13·2 answers
  • What is the penalty for refusing to submit to alcohol testing (drivers ed)
    7·2 answers
  • Will an email sent from a phone say it was sent from your phone
    5·2 answers
  • Java provides a(n) ____ class, which contains many useful methods for manipulating arrays.
    5·1 answer
  • Where is line-of-sight Internet common?<br> In space<br> Outdoors<br> Inside<br> In businesses
    10·1 answer
  • A key field is used to _____. enter a password uniquely identify records merge data list the most important information
    12·2 answers
  • Que funcion tiene la sombrilla forrada de aluminio​
    6·1 answer
  • Given two strings s and t of equal length, the Hamming distance between s and t, denoted dH(s,t), is the number of corresponding
    6·1 answer
  • What constructs break or bend the normal Syntax patterns of scheme?
    15·1 answer
  • I have the requirements for Ace rank on Brainly but hasn't given me it yet. Does it just take longer than normal ranks or someth
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!