Python 과 머신러닝/I. 기초 문법10 Python 기초 2장. 제어문 제어문 : 조건문(if) + 반복문(for, while) 1. 조건문(if) 2. 반복문(while) 3. 반복문(for) 1. 조건문(if) ''' if문 형식1) if 조건식 : 실행문 실행문 ''' var = 10 # 변수 초기화 if var >=50 : print('var =', var) print('var는 5보다 크거나 같다.') print("항상 실행") ''' 형식2) if 조건식 : 실행문 else : 실행문 ''' score = int(input("점수 입력 : ")) if score >= 60 : print("합격!!") else : print("불합격..") # 100~85 : '우수', 84~70 : '보통', 69 이하 : '저조' if score >= 85 .. 2019. 9. 30. Python 기초 1장. 변수와 연산자, print, 문자열처리 1. 변수 2. 연산자 3. print 출력 양식 4. 키보드 입력 & 형 변환(casting) 5. 문자열 유형과 처리 6. escape 처리 1. 변수 ''' 변수(variable) - 형식) 변수명 = 값 or 수식 or 변수명 - 자료가 저장된 메모리 이름 - 생성된 변수 = 객체(object) - 타입이 없음 : R과 동일 - int a = 10 (java) - a = 10 (python) 별도의 타입이 오지 않음 ''' # 1. 변수와 자료형 var1 = "Hello python" var2 = "Hello python" print(var1) # Hello python print(var2) # Hello python print(type(var1), type(var2)) # v.. 2019. 9. 30. 이전 1 2 3 다음