https://school.programmers.co.kr/learn/courses/30/lessons/134240
def solution(food):
result = ''
for i in range(1, len(food)): # food[0] = 물 -> 1부터 시작
temp = food[i] // 2 # 두 선수가 먹을 양
result += str(i) * temp # 음식 종류 * 두 선수가 먹을 양
answer = result + "0" + result[::-1]
return answer
다른 사람 답
def solution(food):
answer = ''
for i, n in enumerate(food[1:]):
answer += str(i+1) * (n//2)
return answer + "0" + answer[::-1]