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
A 200-g hockey puck is launched at an initial speed of 16 m/s up a metal ramp that is inclined at a 30° angle. The coefficients
rusak2 [61]

Answer:

h = 8.588 m

Explanation:

Given:

Mass of hockey puck:  m  =  200  g  =  0.2  K g

Angle of incline:  θ  =  30º   (with respect to horizontal)

Coefficient of static and kinetic friction between the puck and ramp:  

μ s  =  0.4   and    μk  =  0.3

initial speed:  

v  =  3.5  m /s

Let  h  be the vertical height reached by the puck, above the ground. This corresponds to a distance of  

d =  h *sin  30º =  2 *h

along the incline. As the puck is moving, only kinetic friction comes into play as it climbs up the incline. Let  N  be the normal reaction exerted by the metal ramp on the ball. Then,

N  =  m*g *cos  θ  =  0.2 *9.8 1*cos  30 º =  1.6991  N

Therefore, kinetic friction acting on the puck is:  

F k  =  μ k *N  =  0.3 *1.6974  =  0.50974 N

From work energy theorem, the change in kinetic energy should equal the work done by friction and gravity. Therefore,

0.5*  0.2 *16²  =  0.50974 *2h + 0.2*9.81*h

⇒  h = 8.588 m

8 0
3 years ago
What skills do you need to be a marketing manager
faust18 [17]

Answer:

Good teamwork skills.

Communication skills and networking ability.

Adaptability.

Strong attention to detail.

Good organisation and planning skills.

Creativity and writing skills.

Commercial awareness.

Numerical skills.

7 0
3 years ago
Read 2 more answers
Complete the code to finish this program to analyze the inventory for a store that sells purses and backpacks.
suter [353]

Answer:

import <em>csv</em>

fileIn = open("data/bags.txt","r")

countPurse = 0

Explanation:

Edge 2021

4 0
3 years ago
How do you hack someone's wifi. (Hacker needed)​
Flauer [41]

Answer:

Ask God he knows all

Explanation:

3 0
3 years ago
Read 2 more answers
"The principle of ______________ states that programs tend to access data and instructions nearby recently used data and instruc
maria [59]

Answer:

<em>Locality of reference.</em>

Explanation:

In computing, The principle of locality of reference is the probability of a processor to repeatedly access the same set of memory locations within a small time interval. This reference of locality can be spatially based (repetitive usage of data within the same location on the computer memory), or temporally based (repetitive usage of a particular data or resources within a shot time interval). The ability of some computing system to perform this action increases their predictability, and efficiency of memory hierarchy use, among other abilities.

4 0
3 years ago
Other questions:
  • Can I recover my data from HDD if I just started formatting but did not finish it? (I ceased it!)
    7·1 answer
  • Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i
    11·1 answer
  • List 10 programs or applications on your computer other than any Microsoft office programs
    11·1 answer
  • Explain the use of cache memory and the role it plays in improving processing speeds. Plz
    15·2 answers
  • Why transport layer is usingconnectionless services if network layer is providing connection oriented services?
    10·1 answer
  • Ok for whoever answers this, Ill wager 20 points...
    11·2 answers
  • Derek is creating an animation for his class project. What is the first step Derek should follow while creating the animation?
    11·2 answers
  • What are the differences between switches and routers? cse question
    8·1 answer
  • What is the answer of this Q?
    15·2 answers
  • Which three staements about gravity and the formation of the solar system are true?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!