[프로그래머스] 2016년 문제 풀이

 


1. 문제

https://programmers.co.kr/learn/courses/30/lessons/12901

2. 풀이

def solution(a, b):
    month_days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
    answer = 0
    for i in range(12):
        if (i + 1) < a:
            answer += month_days[i]
        elif i + 1 == a:
            answer += b
            break
    return days[(4 + answer)%7]