본문 바로가기
반응형
[코딩테스트] 스택 스택- FILO(First In Last Out): 먼저 들어간 데이터가 나중에 나오는 구조- 함수 호출시 메모리의 스택에 사용 ADTclass Stack: def __init__(self, size:int = 10): self.data = [None for _ in range(size)] self.top = -1 self.size = 10 def isEmpty(self): -> bool if self.top == -1: return True else: return False def isFull(self): -> bool if self.top == (se.. 2024. 7. 5.
[코딩테스트] 배열 / 연결리스트 배열- 연속된 메모리를 이용한 자료구조- 같은 자료형의 묶음 ADTclass Array: def __init__(self, size:int = 10): self.data = [None for _ in range(size)] self.size = size def isEmpty(self): def isFull(self): def insert(self, index, data): if self.data[index] = data def add(self, data): if def remove(self, index): self.data[index] = Non.. 2024. 7. 5.
[코딩테스트] 특징 및 소개 코딩테스트  코딩테스트 사이트- 프로그래머스: 네이버, 카카오 등 IT 기업들의 코딩테스트 사이트- 백준 온라인 저지- solved.ac: 백준 온라인 저지를 단계별로 분류- SW Expert Academy: 삼성 코딩테스트 사이트- Softeer: 현대 자동차그룹 코딩테스트 사이트이론시간복잡도 공간복잡도 2024. 7. 5.
[python3.11 상세] 클래스2 클래스 매직 메서드- __str__- __repr__- __len__- __getitem__- __setitem__- __add__ 추상클래스- from abc import ABC, abstractmethod 2024. 7. 4.
[python3.11 상세] 클래스 1 클래스 클래스 정의- class 클래스 호출 생성자- __init__(self, ...) 소멸자- __del__(self, ...) 클래스 변수 인스턴스 변수 인스턴스 메서드- self 사용- def method(self, ...) 클래스 메서드- cls 사용- @classmethod; def method(cls, ...) 정적 메서드- self나 cls 사용 금지- @staticmethod; def static_method(...) 상속/다중상속- 기본이 되는 부모 우선- 다이아몬드 상속 문제 2024. 7. 4.
[python3.11 상세] 데이터구조 데이터 구조List- 초기화: list() 메서드- 인덱스: list[idx]- 슬라이싱: list[start:end:step]- 삽입: list.insert(index, data)- 추가: list.append(data)- 확장: list.extend(data)- 삭제: del list[idx]; list.pop(idx)- 처음 값 삭제: list.remove(data)- 오름차순 정렬: sort(reverse=False)- 뒤집기: list.reverse()- 데이터 탐색: list.index(data)- 데이터 개수: list.count(data) Dictionary- 초기화: dict() 메서드- 인덱스: dict["key"]; dict.get("key", None)- 추가: dict.update.. 2024. 7. 3.
[python3.11 상세] 문자열 문자열- python3부터 unicode에서 utf-8이 기본으로 변경- 값 변경 불가 문자열 초기화- 한 줄: "- 여러 줄: """ 포매팅- % 포매팅- .format 포매팅- f-string- raw 메서드- 인덱스: str[index]- 슬라이싱: str[start:end:step]- upper() / lower() / capitalize() / title()- find(data) / startswith(data) / endswith(data)- replace(src_value, dest_value) / - split(str) / ''.join(list) / strip() / lstrip() / rstrip()정규표현식re 모듈- re.match()- re.findall(pattern, data).. 2024. 7. 3.
[python3.11 상세] 함수 함수 함수 정의- def 함수 호출 인자- 기본값- 위치인자- 키워드인자- 가변인자    - *args    - **kwargs 반환값 docstring lambda 함수 2024. 7. 3.
[python3.11 상세] 제어문 제어문 조건문조건이 참인 경우 실행- if 문: 조건인 True인 경우 실행- if ~ else 문: 조건인 True인 경우 if의 코드 실행, False인 경우 else의 코드 실행- if ~ elif ~ else 문: 조건인 True인 경우 if의 코드 실행, False인 경우 다음 elif 조건을 확인하는 순서로 진행. 모두 False의 경우 else의 코드 실행- 중첩 조건문 반복문반복되는 경우 실행- while 문: 조건이 True일 경우 실행. 탈출 조건 필수- for ~ in 문: iterable 객체를 순회하면서 실행    - range(start=0,end,step=1)- 중첩 반복문 반복 제어반복문을 탈출하거나 넘어갈때 실행- break: 가까운 반복문 탈출- continue: 가까운 .. 2024. 7. 3.
[Django4] 프로젝트 구조 및 코딩컨벤션 프로젝트 구조myproject/ manage.py myproject/ __init__.py settings.py urls.py wsgi.py app1/ migrations/ __init__.py __init__.py admin.py apps.py models.py tests.py views.py app2/ migrations/ __init__.py __init__.py admin.py apps.py models.py tests.py .. 2024. 7. 3.
반응형