Python Forum
List with "or" value?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List with "or" value?
#1
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
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.
Reply


Messages In This Thread
List with "or" value? - by WolfWayfarer - Jul-20-2018, 04:13 AM
RE: List with "or" value? - by DeaD_EyE - Jul-20-2018, 06:50 AM
RE: List with "or" value? - by perfringo - Jul-20-2018, 07:23 AM
RE: List with "or" value? - by WolfWayfarer - Jul-21-2018, 01:16 AM
RE: List with "or" value? - by perfringo - Jul-23-2018, 08:13 AM
RE: List with "or" value? - by WolfWayfarer - Jul-23-2018, 09:05 AM
RE: List with "or" value? - by perfringo - Jul-23-2018, 01:17 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020