def solution(array, commands):
for i in range(len(commands)):
lst = commands[i][2]
commands[i] = sorted(array[commands[i][0]-1:commands[i][1]])[lst-1]
return commands
def solution(array, commands):
return list(map(lambda x:sorted(array[x[0]-1:x[1]])[x[2]-1], commands))
lambda 매개변수: 함수식
def two_times(x):
return x*2
list(map(two_times, [1, 2, 3, 4]))
> [2, 4, 6, 8]