sum() Signature: sum(iterable, /, start=0) Docstring: Return the sum of a 'start' value (default: 0) plus an iterable of numbers Type: builtin_function_or_method sum() python 내장 함수 반복가능(iterable)한 type을 전부 더해준다. = 반복가능(iterable)한 type : - String, List, Tuple, Dictionary, Range, Set - 단, String은 sum()을 지원하지 않는다. 'start' value를 우선으로 하여 item을 다 합한 값을 반환한다. iterable = → 반복가능(iterable)한 type을 입력 받는다...

시작에 앞서 본 내용은 학습 내용을 기록하기 위함이며 내용에 틀린 점이 있을 수 있으니 이점 유의 부탁드립니다. 문자열 포맷팅 Formatted String 문자열 포맷팅이란? 문자열안에 원하는 어떤 값 또는 계산된 값을 삽입하여 문자열로 사용하기 위한 방법 이를 문자열 보간법이라고도 한다. 문자열 포맷팅 방법 Python에는 3가지의 문자열 포맷팅 방법이 있으며 이는 아래와 같다 1. 고전적인 문자열 포맷팅(Classic String Format) >>> blog_name = 'F7 project' >>> visit_num = 20 >>> print('Blog : "%s"의 방문자 수는 %d 입니다.' %(blog_name, visit_num)) Blog : "F7 project"의 방문자 수는 20 ..
.split() Signature: .split(self, sep=None, maxsplit=-1) Docstring: Return a list of the words in the string, using sep as the delimiter string. Type: method_descriptor .split() str 내장 함수 괄호안의 첫번째 파라메터 문자를 구분자로 하여 문자열을 나눠 준다. 구분자(delimiter) : 임의의 기호로 성립되는 열을 구성 요소로 구분 짓기 위한 문자 . 앞에 str(문자열)을 입력 기존 str(문자열)을 나누어 list로 반환한다. → list type으로 반환 sep = → 나눌 기준이될 문자열을 입력받는다. → 파라메터에 입력값이 없다면 모든 빈공백을 기준으..
[append an element in list] : performance testing → creat an empty list, [] and list() → append(element) and += [element] → 비어있는 list 생성 방법 [], list()의 속도 비교 → append() 함수와 += []의 속도 비교 시작에 앞서 이 글은 list에 요소 한 개 추가 시 append()를 사용하는 것을 추천합니다. *결과값 읽는 법 → %%timeit %%timeit 코드를 반복하여 평균 실행 속도를 구하는 코드 → %%timeit 결과값 959 ms ± 8.6 ms per loop (mean ± std. dev. of 7 runs, 10 loop each) 10번 반복하여 얻은 평균 실행 ..
eval() Signature: eval(source, globals=None, locals=None, /) Docstring: Evaluate the given source in the context of globals and locals. """ The source may be a string representing a Python expression or a code object as returned by compile(). The globals must be a dictionary and locals can be any mapping, defaulting to the current globals and locals. If only globals is given, locals defaults to ..
.sort() Signature: .sort(*, key=None, reverse=False) Docstring: Sort the list in ascending order and return None. .sort() list를 정렬해주는 함수 . 앞에 정렬할 list를 입력 기존 list를 정렬하여 저장한다. → 반환값은 없다. key = → 정렬할 기준을 정해줄 수 있다. → (정령할 기준은 함수로 전달받는다.) reverse = → True : 내림차순 → False : 오름차순(기본설정값) 사용예제: a = [1, 3, 5, 4, 2, 1] a.sort() print(a) [1, 1, 2, 3, 4, 5] reverse = a = [1, 3, 5, 4, 2, 1] a.sort(reverse = T..
[change type of whole list] : performance testing → comparison for loops and list comprehension and map → for문과 리스트 컨프리헨션, 맵의 속도 비교 시작에 앞서 이 글은 list안 요소의 type 변환 시 map()을 사용하는 것을 추천합니다. *결과값 읽는 법 → %%timeit %%timeit -n 10 코드를 반복 하여 평균 실행 속도를 구하는 코드 -n [num_loop] : [num_loop]에 반복 실행할 숫자를 입력(위 코드는 10번을 돌리라는 의미) → %%timeit 결과값 읽는 법 959 ms ± 8.6 ms per loop (mean ± std. dev. of 7 runs, 10 loop each)..
- Total
- Today
- Yesterday
- _의미
- 콘다
- 파이썬 변수
- Python
- sep=
- 재귀?
- print()
- 이스케이프 코드
- list comprehension
- sad asd
- _meaning
- parameters
- anaconda
- 재귀함수 설명
- 재귀함수 이해
- conda
- sdsad
- underscore
- asd ad
- matplotlib
- 변수 덮어쓰기
- 연산속도
- 파이썬
- recursive function
- recursive
- 덮어쓰기
- 이중 프린트
- d asd asd
- 백준
- arguments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |