I'm trying to make a list of the number of days corresponding to months and I need to account for leap years and I want to be able to access either 28 days or 29 days depending on if it's a leap year. This is what I have:
def code(x)
monthdays = [31, lambda x: 28 if leapyear(x) == False else 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
return months[1]
leapyear() is just a function with 1 parameter that returns True if it is a leapyear and False otherwise. For some reason that won't return the number I want. How else can I do this?
lambda x:. And where ismonthscoming from?