로그인 바로가기 하위 메뉴 바로가기 본문 바로가기

파이썬 (Python) 으로 배우는 프로그래밍 기초 (CS101)

임시 이미지 KAIST 전산학부 김문주 교수
http://kooc.kaist.ac.kr/cs101/forum/47159
좋아요 2966 수강생 11721

def three_doubles (word):

    match = “”

    for i in range (1, len(word)):

        if word[i-1] == word[i]:

            match = match + “1”

            if __________ :

                return True

        else:

            match = match + “0”

    return False


질문) for i in range (1, len(word)):에서 len(word)는 전체길이만큼반복하라.. 1은 뭘의미하나요? bookkeeper에서 0(b)다음에 1번째 o부터 대입해서 반복하라는 뜻인가요? 그럼 첫번째꺼는 리턴 false여서 0인데 첫if에서   return True 값이 먼저나와야되니까 0,1 다음에2번째 o부터 대입해서 10101이 되는건가요?