[Tutor] What is day of week from either 20180211 or 02112018 (SOLVED)

Ken Green beachkidken at gmail.com
Tue Feb 6 15:59:15 EST 2018



On 02/06/2018 03:20 PM, David Rock wrote:
>> On Feb 6, 2018, at 13:45, Ken Green <beachkidken at gmail.com> wrote:
>> Traceback (most recent call last):
>>    File "A_Weekday.py", line 20, in <module>
>>      answer = datetime.date(year, month, day).weekday()
>> NameError: name 'datetime' is not defined
> Your error message tells you the problem.  You are importing date _from_ datetime, but then try to call datetime.date
>
>> from datetime import date
> You have _not_ imported date time, so the program doesn’t know what you mean when you say
>
> answer = datetime.date(year, month, day).weekday()
>
> Try just doing
>
> import datetime
>
> instead.
>
>
>> David Rock
> david at graniteweb.com
>
>
Thank you, sir. You put me on the right path. Much appreciated.


More information about the Tutor mailing list