[프로그래머스] 2016년 (Python)

박신희·2021년 11월 5일
0
post-thumbnail

🤜 풀이

def solution(a, b):
    month=[31,29,31,30,31,30,31,31,30,31,30,31]
    days={0:"THU",1:"FRI",2:"SAT",3:"SUN",4:"MON",5:"TUE",6:"WED"}
    return days[(sum(month[:a-1])+b)%7]

month는 1월부터 12월까지 일 수를 나타낸 배열이고 (index는 0~11)
days는 요일을 dictionary형태로 넣어줬다.

profile
log my moments 'u')/

0개의 댓글