Define a function datetonum

Assignment Help Basic Computer Science
Reference no: EM132184077

Define a function  dateToNum(..) which receives as parameter a string representing a date in the format:

"d-mmm-yy", "d-mmm-y", "dd-mmm-yy" or "dd-mmm-y"  (for example "2-Jan-18", "5-Jan-8", "25-Dec-17", "21-Apr-1")

(that is, the days and the years may be represented with one or two digits, the month with the first three letters of the month name (starting with uppercase and rest lowercase).

The function should return a list with three numbers: [y,m,d].

Considering the examples, respectively the list returned would be [2018,1,2] , [2008,1,5], [2017,12,25], [2001,4,21]

(that is, the year is assumed 2001 or later)

As an example, the following code fragment:

st = "2-Jan-18"

print(dateToNum(st))

should produce the output:

[2018, 1, 2]

Program language: python

Reference no: EM132184077

Questions Cloud

Write a program to determine the length of bursts of zero : Write a program to determine the length of bursts of zero's in a list of N numbers stored in an List. The program should record the length of the bursts of zero
Three skills connect with different levels of management : Define technical skills, human skills, and conceptual skills. How do these three skills connect with the different levels of management?
Was it technology that drove this change or was it business : Information technology has changed business as companies compete globally and are pressured to provide quality, speed, and customer service.
Identify business leader who you admire in your community : Not every great business leader is a big talker, but most are excellent communicators. Identify a business leader who you admire in your community.
Define a function datetonum : Define a function dateToNum(..) which receives as parameter a string representing a date in the format:
Human resource management in international market : How would the economic system affect the company GOOGLE human resource management in international market.
Construct a tracking portfolio for the option : Consider a European put option on a non-dividend paying stock with strike price $31 and time to expiration 4 months. Construct a tracking portfolio for option
The importance of change management : You are a project manager and believe that your initiative would be more successful if you had a change manager on your team.
Examine the organizational structure of your company : Examine the organizational structure of your company and suggests ways it can be changed to improve the overall profitability.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Discuss a current risk companies face

Discuss a current risk companies face regarding access control security, and what actions may be taken to address them.

  Design and implement a class that allows a teacher to track

Design and implement a class that allows a teacher to track the grades in a single course. Include methods that calculate the average grade, the highest grade, and the lowest grade. I use C# and visual studio 2012

  Annual report for marks and spencer plc

Download the 2011 Annual Report for Marks and Spencer PLC, from the link provided on Study Space. Review the Annual Report, paying particular attention to the Financial Statements included therein.

  Write down an iterative formula based on the secant method

State which of the secant and Newton's methods is expected to perform better in this case in terms of overall number of exponential function evaluations. Assume a fair comparison, i.e., same floating point system, "same quality" initial guesses, a..

  Find the z-scores corresponding

Find the z-scores corresponding to the given areas under the standard normal distribution "bell curve".

  Perform a diffie-hellman key exchange

What problems in transmission and/or representation might this cause?

  It project management

Research articles and tools on project portfolio management. Summarize the advantages of performing project portfolio management as well as challenges.

  Write a recursive method that accepts an integer n and

Write a recursive method that accepts an integer n and returns the product of the first n even integers. For example if n = 4, it should return 384 (2*4*6*8). The method should throw an Illegal Argument Exception if it is passed a value less than or ..

  The purpose of cryptography and take a position

Explain, in your own words, the purpose of cryptography and take a position on whether or not you believe encryption is sufficiently utilized in organizations today. Provide a rationale with your response. Describe the differences between symmetric a..

  Preferences and well-behaved indifference curves

Consider the assumptions about preferences and well-behaved indifference curves.

  Compare and contrast public and in-house cas

Compare and contrast public and in-house CAs

  Signal with a maximum positive voltage

Given an analog signal with a maximum positive voltage of 5 volts and an 8-bit analog to digital converter, what will be the quantized value of an input voltage

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd