7 Wed

2016๋…„

'''
https://programmers.co.kr/learn/courses/30/lessons/12901
2016๋…„
0. a์›” b์ผ์˜ ์š”์ผ ๊ตฌํ•˜๊ธฐ
1. datetime ์‚ฌ์šฉ
'''
import datetime
def solution(a, b):
    answer = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
    return answer[datetime.datetime(2016, a, b).weekday()]

'''
library ์‚ฌ์šฉ์ด ์•ˆ๋˜์—ˆ๋‹ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ‘ธ๋Š”๊ฒŒ best์ธ ๋“ฏ
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]
'''

Last updated

Was this helpful?