[프로그래머스] n진수 게임 (파이썬, 진법변환)

def solution(n, t, m, p): answer = [] T="0123456789ABCDEF" num="0" for i in range(0,m*t+1): temp="" while i: i,j=divmod(i,n) temp=T[j]+temp num=num+temp for i in range(t*m): if i%m==p-1: answer.append(num[i]) return ''.join(answer)