파이썬/에러 디버깅

IndentationError: unindent does not match any outer indentation level

kimble2 2024. 8. 4. 16:06
반응형

 

파이썬에서는 들여쓰기가 가장 중요합니다

 

드러나 들여쓰기가 잘 못 되었을 경우 IndentationError: unindent does not match any outer indentation level 가 발생합니다

 

 

들여쓰기가 잘못된 위치에서 끝남

문제 코드:

 

def calculate_sum(a, b):
    result = a + b
return result
 

오류 메시지:

IndentationError: unindent does not match any outer indentation level
 

 

해결 방법: 블록 내의 모든 코드는 같은 들여쓰기 수준을 유지해야 합니다. 함수의 반환문은 함수 블록 안에 있어야 합니다.

 

def calculate_sum(a, b):
    result = a + b
    return result
 
 

위처럼 들여쓰기 수준이 일치 되어야지 해당 에러가 사라지게 됩니다

 

 

#python #error #debug #indentation #파이썬 #에러

 

 

반응형