Python
-
[Python_TeamStudy] 파이썬 웹개발 _ 환경세팅. 웹 기초Python/web 2020. 12. 23. 00:33
준비과정 아나콘다 다운로드 : www.anaconda.com/ 파이썬을 사용하여 하는 편리한 프로그램들이 모여있는 패키지. cmder 다운로드 : cmder.net/ Cmder | Console Emulator Total portability Carry it with you on a USB stick or in the Cloud, so your settings, aliases and history can go anywhere you go. You will not see that ugly Windows prompt ever again. cmder.net 해당 부분을 다운받으면 압출파일이 다운받아진다. 압축을 풀면 안에 실행파일이 들어있고, 그 실행파일로 간단히 실행시킬 수 있다. 단순하게 보자면 cdm창을..
-
[Python_Basic]함수Python/Basic 2020. 12. 22. 02:05
함수(function) input x -> function f -> output f(x) def function(parameter) : 실행문1 실행문2 .... return output def func1(parameter): print("hello",parameter) func1(6) 지역변수, 전역변수 def sum(a,b): result = a + b return result a = 2 print(sum(5,6)) def sum(a,b): #이곳에서의 a , b 는 지역변수. 이곳에서 선언되어도 이 안에서만 사용된다. result = a + b c = 3 return result #이곳에서의 a는 전역변수이기에 어느곳에서 선언되어도 인정. a = 2 print(sum(5,6)) multiple re..
-
[Python_Basic]반복문Python/Basic 2020. 12. 22. 01:15
반복문 for for 변수 in (리스트 or 문자열): 실행문1 for index in ex_list: print(index) for index in range(1,10): print(index) for index in ["python","java","C"]" print(index) 반복문 연습 문제 1부터 10까지의 합 sum = 0 for i in range(1,11): sum = sum + i print(sum) 반복문 while while 조건 : 실행문 1 answer = '' while answer != "A": answer = input("Put Alphabet!") print("Your answer : " , answer)
-
[Python_Basic]조건문Python/Basic 2020. 12. 18. 14:28
user1 = int(input()) if user1 >30: print("입력값은 30 초과") 입력값이 30이상이면 출력하기! if 조건(참) : 실행문 user = input() num = int(user) if num>30: print("30이상이야!") if 조건1 and 조건2(둘다 참이면) : 실행문 user1 = int(input()) user2 = int(input()) if user1 > 30 and user2 >30 : print("둘 다 30 넘어") if 조건1 or 조건2(둘 중 하나라도 참이면) 실행문 user1 = int(input()) user2 = int(input()) if user1>30 or user2>30 : print("하나는 30 넘네!") if not 조건 :..
-
[Python_Basic]리스트 배열Python/Basic 2020. 12. 18. 11:51
리스트 선언시 리스트변수명 = [ ] 리스트변수명 = list( ) 리스트변수명 = [데이터1, 데이터2, 데이터3, ...] location = [] location = list() 리스트 추가시 리스트변수명.append(데이터) // 한개만 가능함 리스트변수명.insert(데이터) location.append('인천시') location.insert('원주시') 리스트 삭제시 리스트변수명.remove(데이터) del 리스트변수명[인덱스번호] location.remove('경기도') del location[1] 리스트 수정시 리스트변수명[인덱스번호] = 수정할 데이터 location[1] = '부산시' 리스트 정열 num_set = [8,5,9,4,6,1] num_set.sort() num_set 역순..
-
[Python_Basic]문자열Python/Basic 2020. 12. 18. 01:02
문자열 변수에 문자열 등록시 (한 줄이 아닐 경우) text = """특이하게 변수.함수 형태를 가짐 추후 강의에서 좀더 깊게 다루며 익숙해지도록!""" 문자열의 앞 뒤로 """ 을 붙인다. text.count("좀") 해당 문자열 중 "좀"이란 문자가 들어가는 횟수 print(len(text)) 해당 문자열의 길이. 문자의 갯수. print(text.find("다")) 해당 문자열에서 "다"라는 문자가 나오는 시점 print(text.replace("변수","상수")) 해당 문자열에서 "변수" 라는 문자를 "상수"라는 문자로 대체시킴 인덱스 특정 데이터를 가리키는 번호 슬라이싱 특정 데이터 구간을 가리킴 *신경 쓸 지점은 2에서 5까지여서 2,3,4,5구간을 다 생각할 수 있는데, 뒤에 써져있는 숫자 ..