| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- 알고리즘
- raw data
- 티스토리챌린지
- Class
- OOP
- vscode
- programming
- C++
- Pre-processing
- 백준
- Data Science
- pointer
- 배열
- 반복문
- Deep Learning
- Object Oriented Programming
- const
- 오블완
- 파이썬
- 포인터
- baekjoon
- Python
- 함수
- assignment operator
- string
- 문자열
- pass by reference
- array
- predictive analysis
- function
- Today
- Total
목록python (17)
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 함수 내의 로컬 변수로 복사한 뒤, 해당 변수를 통해 ..
https://leetcode.com/problems/maximal-square/description/ 이 문제를 풀기 위해서 nested for loop을 사용했습니다.Input n x m 에 맞춰 각 반복문에서 현재 위치 기준으로 좌단, 상단, 좌상단 index를 모두 확인하여 그 중 최솟값에 + 1을 하는 전략을 취했습니다. 만약 현재 인덱스가 0이라면 해당 위치에서 구성할 수 있는 최대 사각형의 넓이 또한 0이므로, 즉시 다음 반복문으로 넘어갑니다. 매 반복문의 마지막에 max_num을 업데이트 해주면서, 최종적으로 길이의 제곱을 반환해 넓이 값을 리턴합니다. def maximalSquare(self, matrix: List[List[str]]) -> int: n = len(matrix) ..
An iterable is an object, obj, that produces an iterator via the syntax iter(obj).An iterator is an object that manages the iteration of a series of values. If variable it identifies an iterator object, then each call to the built-in function, next(it), produces a subsequent element from the underlying series, with a StopIteration exception raised to indicate that there are no further elements. ..
Python provides various bitwise operators that allow for convenient manipulation of the individual bits of a binary representation of an integer. For example, the integer 23 is represented in binary with rightmost bits 00010111 and the integer 13 is represented in binary with rightmost bits 00001101. The bitwise and operation, 23 & 13, produces integer 5, which has bit 1 in each position for whi..