728x90
수많은 reportUnboundVariable error
이유를 탐색해보았다.
Reference
➡️ Because range(4) might be something empty (if you overwrite the built-in range), in which case the loop body will never run and a will not get assigned. Which is a problem when it's supposed to get returned.
Maybe you can tell your IDE to ignore this and not show the warning.
Or assign some meaningful default to 'a' before the loop.
➡️ Meaning of 'Unbound'
- A symbol that has not been given a value by assignment or in a function call is said to be “unbound.”
- An unbound variable is one that is not within the scope of a quantifier.
➡️ 해결: while문 선언 전 'mid'에 대한 default value를 할당해주었다.
728x90
'개발 > CS study' 카테고리의 다른 글
[백준] 병합 정렬, 재귀, 1517 버블소트 (0) | 2023.06.29 |
---|---|
[파이썬] global, unlocal / 전역변수, 지역변수 (0) | 2023.06.29 |
[알고리즘] 정렬 / Sorting / 삽입 정렬(Insertion Sorting) (0) | 2023.06.24 |
[백준] 구간 합 / 구간 합 구하기 5 (0) | 2023.06.24 |
[알고리즘] 구간 합 (0) | 2023.06.24 |