편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.05.21

    파이썬 unindent does not match any outer indentation level 에러가 떴습니다.


    import random as rd
    
    
                       class Vocabulary:
    
                            def __init__(self, wdict):
    
                                self.words = wdict.copy()
                                self.untrained = set(self.words)
                                self.renew()
    
                            def renew(self):
    
                                self.target = list(self.untrained)
                                rd.shuffle(self.target)
                                self.untrained = set()
    
                            def target_keys(self):
    
                                return self.target
    
                            def check(self, key, value=None):
    
                                if key not in self.words:
    
                                    return None
    
                                if value is not None:
    
                                    if self.words[key] == value:
    
                                        return Ellipsis
    
                                    self.untrained.add[key]
    
                                return self.words[key]
    
                            def shuffle(self):
    
                                rd.shuffle(self.target)
    
                        wdict = {}
    
                        while True:
    
                            line = input("등록/암기할 단어의 철자와 뜻 : ")
    
                            tokens = line.split()
    
                            if len(tokens) != 2 :
    
                                break
    
                            wdict[tokens[1]] = tokens[0]
    
                        voc = Vocabulary(wdict)
    
                        while len(voc.target_keys()) > 0:
    
                            print("\n암기할 단어 :", voc.target_keys())
    
                            nQNA = int(input("단어별 문답 횟수 : "))
    
                            print()
    
                            for index in range(0, nQNA):
    
                                voc.shuffle()
    
                                for meaning in voc.target_keys():
    
                                    answer = input("'" + meaning + "'의 뜻을 가진 단어는? ")
    
                                    word = voc.check(meaning, answer)
    
                                    if word is Ellipsis:
                                        print("정답입니다.")
    
                                    else:
                                        print("정답은 '" + word + "'입니다.")
    
                            voc.renew()
    
                        print("\n단어 학습이 끝났습니다.")
    

    라고 책에 있는 그대로 소스코드를 작성하였는데 wdict = {} 부분부터 계속 'unindent does not match any outer indentation level'라는 에러가 뜹니다. 들여쓰기 문제라는 것 같은데 분명 책에 있는 그대로 작성했는데, 왜 자꾸 이런 에러가 뜨는지.

    교재에 문제가 많은 건 둘째 치고 어떻게 고쳐야 하나요. 도와 주시면 정말 감사하겠습니다!

  • 프로필 ᅟᅟᅟᅟ님의 편집
    날짜2021.05.21

    도와 주세요! unindent does not match any outer indentation level 에러가 떴습니다.


    import random as rd
    
    
                       class Vocabulary:
    
                            def __init__(self, wdict):
    
                                self.words = wdict.copy()
                                self.untrained = set(self.words)
                                self.renew()
    
                            def renew(self):
    
                                self.target = list(self.untrained)
                                rd.shuffle(self.target)
                                self.untrained = set()
    
                            def target_keys(self):
    
                                return self.target
    
                            def check(self, key, value=None):
    
                                if key not in self.words:
    
                                    return None
    
                                if value is not None:
    
                                    if self.words[key] == value:
    
                                        return Ellipsis
    
                                    self.untrained.add[key]
    
                                return self.words[key]
    
                            def shuffle(self):
    
                                rd.shuffle(self.target)
    
                        wdict = {}
    
                        while True:
    
                            line = input("등록/암기할 단어의 철자와 뜻 : ")
    
                            tokens = line.split()
    
                            if len(tokens) != 2 :
    
                                break
    
                            wdict[tokens[1]] = tokens[0]
    
                        voc = Vocabulary(wdict)
    
                        while len(voc.target_keys()) > 0:
    
                            print("\n암기할 단어 :", voc.target_keys())
    
                            nQNA = int(input("단어별 문답 횟수 : "))
    
                            print()
    
                            for index in range(0, nQNA):
    
                                voc.shuffle()
    
                                for meaning in voc.target_keys():
    
                                    answer = input("'" + meaning + "'의 뜻을 가진 단어는? ")
    
                                    word = voc.check(meaning, answer)
    
                                    if word is Ellipsis:
                                        print("정답입니다.")
    
                                    else:
                                        print("정답은 '" + word + "'입니다.")
    
                            voc.renew()
    
                        print("\n단어 학습이 끝났습니다.")
    

    라고 책에 있는 그대로 소스코드를 작성하였는데 wdict = {} 부분부터 계속 'unindent does not match any outer indentation level'라는 에러가 뜹니다. 들여쓰기 문제라는 것 같은데 분명 책에 있는 그대로 작성했는데 왜 자꾸 이런 에러가 뜨는지..교재에 문제가 많은 건 둘째 치고 어떻게 고쳐야 하나요 ㅠㅠ 도와 주시면 정말 감사하겠습니다..!!

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.05.21

    도와 주세요! unindent does not match any outer indentation level 에러가 떴습니다.


    import random as rd

                   class Vocabulary:
    
                        def __init__(self, wdict):
    
                            self.words = wdict.copy()
                            self.untrained = set(self.words)
                            self.renew()
    
                        def renew(self):
    
                            self.target = list(self.untrained)
                            rd.shuffle(self.target)
                            self.untrained = set()
    
                        def target_keys(self):
    
                            return self.target
    
                        def check(self, key, value=None):
    
                            if key not in self.words:
    
                                return None
    
                            if value is not None:
    
                                if self.words[key] == value:
    
                                    return Ellipsis
    
                                self.untrained.add[key]
    
                            return self.words[key]
    
                        def shuffle(self):
    
                            rd.shuffle(self.target)
    
                    wdict = {}
    
                    while True:
    
                        line = input("등록/암기할 단어의 철자와 뜻 : ")
    
                        tokens = line.split()
    
                        if len(tokens) != 2 :
    
                            break
    
                        wdict[tokens[1]] = tokens[0]
    
                    voc = Vocabulary(wdict)
    
                    while len(voc.target_keys()) > 0:
    
                        print("\n암기할 단어 :", voc.target_keys())
    
                        nQNA = int(input("단어별 문답 횟수 : "))
    
                        print()
    
                        for index in range(0, nQNA):
    
                            voc.shuffle()
    
                            for meaning in voc.target_keys():
    
                                answer = input("'" + meaning + "'의 뜻을 가진 단어는? ")
    
                                word = voc.check(meaning, answer)
    
                                if word is Ellipsis:
                                    print("정답입니다.")
    
                                else:
                                    print("정답은 '" + word + "'입니다.")
    
                        voc.renew()
    
                    print("\n단어 학습이 끝났습니다.")
    

    라고 책에 있는 그대로 소스코드를 작성하였는데 wdict = {} 부분부터 계속 'unindent does not match any outer indentation level'라는 에러가 뜹니다. 들여쓰기 문제라는 것 같은데 분명 책에 있는 그대로 작성했는데 왜 자꾸 이런 에러가 뜨는지..교재에 문제가 많은 건 둘째 치고 어떻게 고쳐야 하나요 ㅠㅠ 도와 주시면 정말 감사하겠습니다..!!