#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목중간참조 42021-04-17 21:53
작성자

def getResult(status):

    type.status:str

    if status.count('_')==0:

        return 'You win'

    else:

        return 'You lose'

def updateStatus(word, x, status):

    if x in word:

        for i in range(len(word)):

            if word[i]==x:

                status=status[:i]+x+status[i+1:]

        new_status=status

        return new_status

    else:

        new_status=status

        return new_status

    print(new_status)

def startGame(word):

    status='_'*len(word)

    count=len(word)

    print(status)

    print(count,'chances')

    for i in range(1,count+1):

        x=input('Enter a letter:')

        updateStatus(word, x, status)

        print(new_status)

        print(count-i,'chances')

        if word==status:

            return 'You win'

    print(getResult(status))


new_status가 정의되지 않는 값이라고 자꾸 뜨네요 표시한 부분에서 오류가 나는 것 같은데 어떻게 고쳐야 할까요?? new_status는 윗부분에서 정의했었는데 말이져

댓글
이전중간참조문제3 에서 입력파라미터 질문2021-04-17
다음step11 질문2021-04-17