I have written following Python Function which should return Day, when year, month & date is provided to function. For Testing, I have limit it to 3 years & then call the function using print. But it always return “Saturday”. What’s wrong in function.
enter code here
def dayOfYear(y,m,d):
if y in [2018,2019,2020]:
if m in [1,2,3]:
if d in [31,28,1]:
return('Saturday')
else:
return('Thursday')
else:
return('Sunday')
else:
return(None)
print(dayOfYear(2018,1,31))
print(dayOfYear(2019,2,28))
print(dayOfYear(2020,3,1))