You are viewing a single comment's thread. Return to all comments →
OMG didn't know cal.day_name exists, I wrote the following code
import calendar import re def find_the_day(date): month, day, year = date.split() months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] dotws = [x.upper() for x in ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']] dates = calendar.TextCalendar(firstweekday = 7).formatyear(int(year)).split('\n\n') rmonth = months[int(month) -1] for x in dates: if rmonth in x: weeks = x.split('\n') week = [re.split('\s{3,}', week) for week in weeks] week = [x for y in week for x in y if re.search('[0-9]', x)] targets = week[int(month)%3-1 : len(week) : 3] for i in range(len(targets)): if int(day) in map(int, targets[i].split()): target = map(int,targets[i].split()) if str(1) != day: dotw = dotws[list(target).index(int(day))] else: dotw = dotws[-(list(target).index(int(day))+1)] return dotw print(dotw)
Although it works fine in jupyter notebook, I don't see why it doesn't work withint Hackers environment, does anybody know what the problem is?
althoug
Seems like cookies are disabled on this browser, please enable them to open this website
Calendar Module
You are viewing a single comment's thread. Return to all comments →
OMG didn't know cal.day_name exists, I wrote the following code
Although it works fine in jupyter notebook, I don't see why it doesn't work withint Hackers environment, does anybody know what the problem is?
althoug