Lv0 프로그래머스(Programmers)[Python][파이썬] 가까운 1로 찾기

"""
출처: 프로그래머스 코딩 테스트 연습,
https://school.programmers.co.kr/learn/courses/30/lessons/181898
"""

# 풀이 과정
def solution(arr, idx):
for x in range(idx,len(arr)):
if arr[x]==1:
return x
return -1