Popular
- Python 나머지 % 와 몫 // 연산자, 짝수 홀수 함수 만들기 Python의 %와 // 연산자Python에서 나눗셈과 관련된 연산자는 여러 가지가 있다.10 / 3 # 일반 나눗셈10 // 3 # 몫10 % 3 # 나머지각각의 결과를 확인해보면 다음과 같다.print(10 / 3) # 3.3333333333333335print(10 // 3) # 3print(10 % 3) # 1 즉,/ : 나눗셈의 결과// : 나눈 몫(quotient)% : 나눈 나머지(remainder)를 구한다. 값의 타입이 float인지 int인지 알아두는 것이 좋다.print(10 / 3) # 3.3333333333333335 (float)print(10 // 3) # 3 (int)print(10 % 3) # 1 (int) is_even(num): 짝수인지 .. 2026.09.22
- python programing 수업 노트: strings StringSlice: backward & last stringsword = testword[::-1]word[-2:]Methodsstring.lower() & string.upper()UPPER = text.upper()lower = text.lower()# re-allocationstring.capitalize()Capitalize = text.capitalize()# re-allocationsplit & join# string to listtext_list = string.split()# list to stringnew_string = ' '.join(text_list)replacestring.replace(old, new, count)Package: Counter()from collections .. 2026.09.09
- python programing 수업 노트: functions 1. Review for Loop“When they stop?”break: stops loop immediatelycontinue: skips to the next iteration# break# continue2. FunctionsPackages: math, timeimport math #, time (X), import separatelyimport timeTime: end_time - start_timeimport mathtime_start = time()for i in range(0, 2000000): math.sqrt(i)time_end = time()print('This took', time_end - time_start, 'seconds.')# Output# This took 0.18.. 2026.09.09
뉴스레터
-
Python SciPy 베르누이 분포(Bernoulli Distribution)와 주요 Methods 정리 베르누이 분포 (Bernoulli Distribution): 결과가 두 가지뿐인 실험을 나타내는 확률 분포ex) 동전 앞/뒤, 검사 정상/불량P(X = 1) = p P(X = 0) = 1 - p stats.bernoullifrom scipy import stats rvs() - Random Variates: 랜덤 값 생성stats.bernoulli.rvs(0.7)for x in range(0, 5): print(rand_variable_0p3.rvs(4))"""[0 0 0 0][1 0 0 0][1 0 0 0][1 0 0 0][0 0 0 0]""" pmf() - Probabiliey Mass Function: 정확히 이 값이 나올 확률은 얼마인가?stats.bernoulli.pmf(x, p)# Yes.. -
python programing 수업 노트: strings StringSlice: backward & last stringsword = testword[::-1]word[-2:]Methodsstring.lower() & string.upper()UPPER = text.upper()lower = text.lower()# re-allocationstring.capitalize()Capitalize = text.capitalize()# re-allocationsplit & join# string to listtext_list = string.split()# list to stringnew_string = ' '.join(text_list)replacestring.replace(old, new, count)Package: Counter()from collections .. -
python programing 수업 노트: functions 1. Review for Loop“When they stop?”break: stops loop immediatelycontinue: skips to the next iteration# break# continue2. FunctionsPackages: math, timeimport math #, time (X), import separatelyimport timeTime: end_time - start_timeimport mathtime_start = time()for i in range(0, 2000000): math.sqrt(i)time_end = time()print('This took', time_end - time_start, 'seconds.')# Output# This took 0.18.. -
python Variablesprint Comparingpriority 'If' While loops For loops -
python 리스트 원소 제거: remove, pop, del, list comprehension, clear 프로그래머스 코딩테스트 '없는 숫자 더하기' 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr아이디어full_numbers = [0부터 9까지]에서numbers 입력값에 있는 수 제거full_numbers에 남은 숫자 합1. 값으로 제거: remove()fruits = ["apple", "banana", "orange", "banana"]fruits.remove("banana")print(fruits) # ['apple', 'orange', 'banana']* 값이 없으면 ValueError 발생2. 인덱스로 제거: pop()fruits = ["apple", "banana", "orange"]item = fr..
728x90