Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 |
Tags
- Object Oriented Programming
- string
- pointer
- 백준
- 포인터
- 배열
- 알고리즘
- 오블완
- function
- 문자열
- Deep Learning
- array
- pass by reference
- C++
- baekjoon
- 반복문
- Python
- 티스토리챌린지
- raw data
- Class
- assignment operator
- 파이썬
- predictive analysis
- 함수
- programming
- Pre-processing
- Data Science
- OOP
- const
- vscode
Archives
- Today
- Total
목록2025/07 (1)
Channi Studies
Python 함수를 다룰 때에, nested function definition에서 inner function의 함수 프레임에서, 상위 프레임의 변수를 수정하려고 하면 오류가 발생합니다. n을 함수 인자로 받아, n번 특정 문자를 출력해주는 또 다른 함수를 반환하는 print_n_times 함수에 대해서 알아보겠습니다. def print_n_times(n): def a(word): times = n while times: print(word) times -= 1 return a print_n_times(2)("hey")최초 인자로 전달된 n (2)를 times 라는 a 함수 내의 로컬 변수로 복사한 뒤, 해당 변수를 통해 ..
python
2025. 7. 3. 12:22