Python Forum
List with "or" value?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List with "or" value?
#3
My personal experience with assignments is that they teach you solve problems with tools you currently studying and not in creative or effective way. It often leads to bad habits in solving problems.

Why would I invent a wheel when there are cars? I would write utility function to get number of days in month (of course, one can use monthrange directly) using built-in calendar module:

import calendar

def days_in_month(y, m):
    return calendar.monthrange(y, m)[1]
Calendar is 'battaries included' module and there is function monthrange:

Quote:calendar.monthrange(year, month)
Returns weekday of first day of the month and number of days in month, for the specified year and month.
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.
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