Question: I am getting an error and I do not know how to solve it . Here is the error: The call sunset ( datetime .
I am getting an error and I do not know how to solve it Here is the error:
The call sunsetdatetimedatedaycycle returns datetime.datetime not datetime.datetime
Here is the question and code:
def sunsetdatedaycycle:
Returns the sunset datetime day and time for the given date
This function looks up the sunset from the given daycycle dictionary. If the
daycycle dictionary is missing the necessary information, this function
returns the value None.
A daycycle dictionary has keys for several years as int The value for each year
is also a dictionary, taking strings of the form mmdd The value for that key
is a THIRD dictionary, with two keys "sunrise" and "sunset". The value for each of
those two keys is a string in hour time format.
For example, here is what part of a daycycle dictionary might look like:
:
:
"sunrise": :
"sunset": :
:
"sunrise": :
"sunset": :
Parameter date: The date to check
Precondition: date is a date object
Parameter daycycle: The daycycle dictionary
Precondition: daycycle is a valid daycycle dictionary, as described above
year date.year
month date.month
day date.day
strdate date.strftimemd
if stryear not in daycycle:
return None
t daycyclestryearstrdatesunrise
return strtotimet
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
