Programmers 2016년

Solution

import datetime

def solution(a, b):
    return datetime.datetime(2016, a, b).strftime("%a").upper()
  • 다른 사람 풀이
def getDayName(a,b):
    months = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    days = ['FRI', 'SAT', 'SUN', 'MON', 'TUE', 'WED', 'THU']
    return days[(sum(months[:a-1])+b-1)%7]

print(getDayName(5,24))