파이썬 문제(2)
-
윤인선님 강의[21] for문 문제
21. 리스트와 for 반복문 numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] output = [[],[],[]] for number in numbers: output[(numbers - 1) % 3].append(number) print(output) #[ [1, 4, 7], [2, 5, 8], [3, 6, 9] ] ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ 풀이 numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] output = [[], [], []] output[1].append(1) output[2].append(2) output[0].append(3) output[1].append(4) output[2].append(5) output[0].appe..
2021.08.01 -
객체지향적 프로그래밍, class
# 절차적 프로그래밍, 구조적 프로그래밍, 함수지향적 프로그래밍 - 함수 기반 언어 # 대표적으로 c 언어 # 해결해야 하는 문제를 기능단위로 세분화 # 하나의 기능을 다시 세부기능으로 나눠요. # 그러다보면 더 이상 나눌 수 없는 단위 기능이 도출되는데 이를 우리가 배운 # 함수(function)형태로 구현 # Top down 방식, divide and conquer # 프로그램의 분석과 설계가 쉽다. -> 코드로 작성하고 프로그램을 완성 # 프로그램의 구현시간이 짧다. -> 비용 절감 # 프로그램을 수정하기가 쉽지 않다. 재활용성이 떨어진다. => 유지 보수성이 좋지 않다. # 1990년 들어오면서 인터넷이 보급 -> 사람들의 요구사항이 많아지기 시작. # 프로그램의 수정 요청이 많아짐 -> 개발 비..
2021.07.02