Jun-13-2019, 04:15 PM
(Jun-13-2019, 03:13 PM)jefsummers Wrote: Note that the non-homework assignment though requires use of a data structure for the months and the use of subroutines.
Guilty as charged (almost). There is no subroutine but I believe that list of days in month qualifies as 'data structure'. Yes, it doesn't have name and will cease to exist but definitely list comprehension creates list. Naming it would have taken fun out of it. And of course - one can define function and return whole thing - this way there will be subroutine as well
# datastructure which holds days of months :-) [[31, 30][i <= 6 and i % 2 == 0 or i > 7 and i % 2 != 0] if i != 2 else [28, 29][year % 4 == 0 and year % 100 != 0 or year % 400 == 0] for i in range(1 ,13)]
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.