[Programmers] ํคํจ๋ ๋๋ฅด๊ธฐ
์ฝ๋ def keypad(current_N,next_N): dic = {'1':[0,0],'2':[0,1],'3':[0,2],'4':[1,0],'5':[1,1],'6':[1,2],'7':[2,0],'8':[2,1],'9':[2,2],'*':[3,0],'0':[3,1],'#':[3,2]} x1,y1 = dic[current_N] x2,y2 = dic[next_N] return abs(int(x1) - int(x2)) + abs(int(y1) - int(y2)) def solution(numbers,hand): ans = '' left = '*' right = '#' for i in numbers: if i in [1,4,7]: left = str(i) ans += 'L' elif i in [3,6,9]: ..
์ฝ๋ฉํ
์คํธ ์คํฐ๋ 4์ฃผ์ฐจ
1. 2016๋
def solution(a, b): date = ['FRI','SAT','SUN','MON','TUE','WED','THU'] month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] cnt = 0 for i in range(a-1): cnt += month[i] ans = (cnt + b) % 7 return date[ans-1] 2. ๋ฌธ์์ด ๋ค๋ฃจ๊ธฐ ๊ธฐ๋ณธ def solution(s): if len(s) == 4 and s.isdigit(): return True elif len(s) == 6 and s.isdigit(): return True else: return False 3. ๋ฌธ์์ด ๋ด๋ฆผ์ฐจ์์ผ๋ก ๋ฐฐ์นํ๊ธฐ def solution(s): s..