목록python (3)
개발화이팅
모듈 - 작은 프로그램 조각을 뜻 함 패키지 - 모듈의 묶음. 일종의 디렉토리처럼 하나의 패키지 안에 여러개의 모듈이 존재 모듈들이 포함관계를 가지며 거대한 패키지를 만듬 연습 fah_converter.py 작성 def convert_c_to_f(celcius_value): return celcius_value*9.0/5+32 module_ex.py 작성 import fah_converter print("Enter a celsius value:") celsius = float(input()) fahrenheit = fah_converter.convert_c_to_f(celsius) print("That's", fahrenheit,"degrees Fahrenheit") import fah_converter..
class Decorator1: def __init__(self,f): print("initializing Decorator1...") self.func = f #인스턴스 뒤에 ()붙여 호출하면 __call__메서드가 호출됨 def __call__(self): print("Begin : {0}".format(self.func.__name__)) self.func() print("End : {0}".format(self.func.__name__)) def print_hello(): print("Hello") print_hello = Decorator1(print_hello) print_hello() decorator1의 인스턴스를 생성할 때 __init__() 메서드를 호출 func 데이터 속성이 prin..
자료구조 - 특징이 있는정보를 메모리에 효율적으로 저장 및 반환하는 방법, 대용량 일수록 메모리에 빨리저장 검색되어 효율적으로 사용하고 실행시간 단축 가능 스택 = 나중에들어온 값이 먼저나가는 구조 (LIFO) 큐 = 먼저 들어온 값이 먼저나가는 구조 (FIFO) 튜플 = 리스트와 같지만 데이터 변경 불가 세트 = 데이터 중복 불가, 수학의 집합 연산 지원하는 자료구조 딕셔너리 = key와 value 형태의 데이터를 저장하는 자료구조, key 값 중복x 스택 파이썬에서 리스트 이용해 스택 구현 해보기 word = input("Input a word: ") word_list = list(word) print(word_list) result=[] for _ in range(len(word_list)): # ..