May-26-2018, 07:55 AM
There is no case statement in Python. We have good data structures.
You can use for example a dict:
You can use for example a dict:
def get_weekday_number(day): """ The function returns the number of weekday for given day. Lower case and upper case are allowed. """ days = { 'Friday': 4, 'Monday': 0, 'Saturday': 5, 'Sunday': 6, 'Thursday': 3, 'Tuesday': 1, 'Wednesday': 2, } return days[day.title()]
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!