Jul-20-2018, 04:13 AM
I'm having trouble with an assignment about leap years. I had a basic (ugly) code that did the job, however when I asked for feedback from the teacher he sent me a corrected version of my code, asking for a list with the number of days in the months with an option between 28 and 29 for february.
What I had initially done was lump all 30 days months together in a list, lump 31 days months in another and leave february alone. But here he's asking me to do something like
What I had initially done was lump all 30 days months together in a list, lump 31 days months in another and leave february alone. But here he's asking me to do something like
days_in_months = [31, 28 or 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]and I have no clue how to create such a list or even worse how to access it later... how do I call for 28 or 29?
days_in_months[1]???I've tried looking it up on the internet but I guess I'm not using the right keywords since I couldn't find anything relevant.