> On Apr 13, 2018, at 09:24, Neil Cerutti <ne...@norwich.edu> wrote:
> On 2018-04-12, Scharrer, Brianna <bschar...@luc.edu> wrote:
>> Applications of basic language syntax
>> Date/time string parsing
>> Time stamps on data are often recorded in the standard ISO date
>> and time format as shown below
>> 1999-02-14T21:02:37 ----> 9:02pm on February 14, 1999
>> Write code that when given a datetime string and outputs a
>> human readable version exactly in the format specified below.
> I disagree that the first version isn't human readable. It is
> both human readable and stores the date/time in lexicographic
> order, which is extremly useful for both humans and machines.
Don’t nitpick the definition of “human readable;” it isn’t relevant to the
assignment and just serves to confuse the student. Using the phrase “human
readable” is just a poor choice for describing the assignment parameters:
changing from one format to another (ISO -> “standard English” (for lack of a
better description of the target format). That’s the only thing that matters
in this context.
For the assignment, think about the following:
How to separate the date from the time
How to separate the YYYY-MM-DD into discreet variables
How to convert the digit month into a Full name (e.g, convert 2 -> February)
How to convert a 24-hour time into a 12-hour am/pm time
How to print the bits into a specific format
Tackle each part separately, and it should be fairly straightforward. Look up
methods for parsing formatted strings as a place to start.
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options: