Study_note(zb_data)/Python (14) 썸네일형 리스트형 스터디 노트 (기초 수학 01 ~ 30)_0717 (기초 수학 01 ~ 15) 📌 약수 어떤 수를 나누어 떨어지게 하는 수 나머지가 0이다 (나누어 떨어지기 때문에) inputNumber = int(input('0보다 큰 정수 입력 : ')) for number in range (1, inputNumber + 1): if inputNumber % number == 0: #입력한 정수와 반복되어 돌고 있는 정수 둘을 나눠서 나머지가 0일때 print('{}의 약수 : {}'.format(inputNumber, number)) 📌 소수 1과 자신만을 약수로 가지는 수 (단, 1은 제외) 1~30까지 몫으로 나올 수 있는 소수의 경우의 수를 생각 ex) 2,3,5.. (5*몫)에 5보다 작은 소수를 더한다. (기준이 5로 나눈 몫이기 때문에 기본적으로 5로 .. 0713_스터디 노트 (파이썬 중급 53 ~ 65) 📌 연습문제 - 클래스 1 (TV) - 모듈코드 class NormalTv: def __init__(self, i=32, c='black', r='full-HD'): self.inch = i self.color = c self.resolution = r self.smartTv = 'off' self.aiTv = 'off' def turnOn(self): print('TV power on!!') def turnOff(self): print('TV power off!!') def printTvInfo(self): print(f'inch: {self.inch}inch') print(f'color: {self.color}') print(f'resolution: {self.resolution}') print(f'.. 0712_스터디 노트 (파이썬 중급 41 ~ 52) 📌 연습문제 - 함수 1 (단리와 월 복리) 단리와 월복리를 구해보자 def formatedNumber(n): return format(n, ',') #단리 def simpleInterest(price, year, percent): totalMoney = 0 totalRateMoney = 0 for i in range(year): totalRateMoney += price * (percent * 0.01) #년 복리로 계산 totalMoney = price + totalRateMoney return formatedNumber(int(totalMoney)) #월복리 def compoundInterest(price, year, percent): year = year * 12 #12개월 기준로 치환 month.. 0711_스터디 노트 (파이썬 중급 20 ~ 40) 📌 객체지향 프로그래밍 객체를 이용한 프로그램, 객체는 속성과 기능으로 구성 객체는 클래스에서 생성 (클래스는 객체를 만들기 위한 틀로서 작동한다) 코드 재 사용 및 모듈화에 좋다 📌 객체지향 프로그래밍 class Car: def __init__(self, col, len): #생성자, 속성 self.color = col self.length = len def doStop(self): #기능 print('STOP!!') def doStart(self): #기능 print('START!!') def printCarInfo(self): #기능 print(f'self.color: {self.color}') print(f'self.length: {self.length}') car1 = Car('red', 200.. 0710_스터디 노트 (파이썬 중급 01 ~ 19) 📌 함수 파이썬 함수는 수학의 함수와 동일 def 키워드, 함수명, 들여쓰기 이용하여 선언. 📌 함수 호출 함수 내에서 다른 함수를 호출할 수 있다. def fun1(): print('fun1 호출!') fun2() print('fun2 호출 후에 실행!') #먼저 실행된 fun(2)가 처리가 다 되고 나서 맨 마지막에 출력됨 def fun2(): print('fun2 호출!') fun3() def fun3(): print('fun3 호출!') fun1() 📌인수와 매개 변수 함수 호출 시 함수에 데이터를 전달할 수 있다. def greet(customer1, customer2): # 매개 변수 print('{}님, {}님 안녕하세요 :)'.format(customer1, customer2)) greet.. 이전 스터디 노트 가져오기 OT - https://velog.io/@kloudzero/0703스터디-노트 0703_스터디 노트 잘하려고 하는 것보단 꾸준히 하는 것이 더 중요할 것 같다.비전공자인 나로서는 잘 해야겠다는 욕심도 필요하겠지만욕심만 많아져서 쉽게 포기할 수도 있을 것 같다.나만의 속도가 있고 스텝 velog.io 1 - https://velog.io/@kloudzero/0704스터디노트 0704_스터디 노트 (기초 1 ~ 4) 1991년 네덜란드 개발자 귀도 반 로섬이 만듦소규모 프로젝트에 사용하기 위해 만듦Python 이라는 이름은 귀도 반 로섬이 좋아하는 프로그램에서 유래무한 정수를 처리할 수 있다 (실수 제외)문법 velog.io 2- https://velog.io/@kloudzero/0705스터디-노트-기초-5.. 이전 1 2 다음