Re: [Tutor] PLEASE HELP

2018-04-13 Thread Neil Cerutti
On 2018-04-12, Scharrer, Brianna  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
>
> -mm-ddThh:mm:ss
>
> 2018-01-02T18:31:16 > 6:31pm on January 2, 2018
>
> 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.

> [Morning, Noon, Afternoon, Evening, or Night], X:XX[am or pm] on [Month as a 
> word] [day], [year]
>
> E.g. 1999-02-14T21:02:37 would be ?Night, 9:02pm on February 14, 1999?

You will need to ask for clarification from your teacher for the
deliniation between morning, noon, afternoon, evening and night.
There's no international standard I'm aware of.

>
> Do not use any datetime string function, though depending on
> your language they would be useful to do this in practice.

They certainly would!

> Hint: you?ll have to cast strings to integers in order to
> perform the if statements which place [Morning, Noon?], [am or
> pm] and [Month as a word] appropriately.

With the exception of converting string to integer (as Alan
discussed) I recommend using a dictionaries for conversion,
rather than if statements, if you're allowed.

-- 
Neil Cerutti

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PLEASE HELP

2018-04-13 Thread David Rock

> On Apr 13, 2018, at 09:24, Neil Cerutti  wrote:
> 
> On 2018-04-12, Scharrer, Brianna  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 -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.

— 
David Rock
da...@graniteweb.com




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PLEASE HELP

2018-04-13 Thread Neil Cerutti
On 2018-04-13, David Rock  wrote:
>
>> On Apr 13, 2018, at 09:24, Neil Cerutti  wrote:
>> 
>> On 2018-04-12, Scharrer, Brianna  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.

It is relevant to the assignment if the student hadn't noticed
that the date was human readable. I was hoping to correct this
possible misapprehension resulting from the poor assignment
language.

-- 
Neil Cerutti

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PLEASE HELP

2018-04-13 Thread Mayo Adams
 discrete, not discreet.

On Fri, Apr 13, 2018 at 11:38 AM, Neil Cerutti  wrote:

> On 2018-04-13, David Rock  wrote:
> >
> >> On Apr 13, 2018, at 09:24, Neil Cerutti  wrote:
> >>
> >> On 2018-04-12, Scharrer, Brianna  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.
>
> It is relevant to the assignment if the student hadn't noticed
> that the date was human readable. I was hoping to correct this
> possible misapprehension resulting from the poor assignment
> language.
>
> --
> Neil Cerutti
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Mayo Adams

287 Erwin Rd.
Chapel Hill, NC 27514
(919)-780-3917
mayoad...@gmail.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor