from datetime import date
from datetime import datetime
def get_time_delta(comic1,comic2):
if comic1 or comic2 is type(None):
dict1 = comic1["day"],comic1["month"],comic1["year"]
dict2 = comic1["day"],comic1["month"],comic1["year"]
date_one = date(comic1["year"],comic1["month"],comic1["day"])
date_two = date(comic2["year"],comic2["month"],comic2["day"])
difference = date_two - date_one
else:
return None
comic1, comic2 = get_all_comics(513, 514)
print(get_time_delta(comic1,comic2))
I want the function to return None if parameter1(comic1) or parameter2 (comic2) is None. However I phrase the sentence, it just always returns None.
The last part, using the function "get_all_comics(513,514)" returns one dict each for each of the two numbers, which I then pass into the get_time_delta function.
I suspect it has something to do with Python not defining the parameters as dictionaries until later in the code, but im not knowledgeable enough in Python to know exactly how it does this.