728x90
반응형

파이썬이론 3

[파이썬] 기초 다지기 예제 2

자료형 살펴보기 3 : isinstance >>> isinstance(3,int) isinstance(3.14,float) isinstance('3.14',str) isinstance(True,bool) isinstance([],list) 한 문자열 접근 : indexing (거꾸로(-) 접근)) >>> 'hello'[-0] 'hello'[-1] 'hello'[-2] 'hello'[-5] 'hello'[-6] 부분 문자열 접근 : slicing >>> 'hello'[0:1] 'hello'[0:2] 'hello'[1:3] 'hello'[:3] 'hello'[3:] 'hello'[:] 'hello'[1:4:2] 'hello'[::2] 문자열 중요 함수 : len(문자열 갯수), join(문자열 합치기), s..

[파이썬] 함수 활용하기 (명령어)

참고링크 Built-in Functions — Python 3.12.0 documentation Built-in Functions The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.,,,, Built-in Functions,,, A, abs(), aiter(), all(), a... docs.python.org 함수 입력값 = 인수(argument) 함수 결과값 = 리턴값(return value) 함수 결과값을 전달하는 것 = 리턴한다(return) abs(숫자 데이터) 숫자 데이터의 절대값을 구하는 ..

[파이썬] 데이터 타입과 for 반복문

데이터 타입(data Type) 프로그래밍 언어가 처리 가능한 데이터 종류, 데이터 유형이라고도 합니다. 기본 데이터 타입(Primary Data Type) : 프로그래밍 언어가 처리할 수 있는 최저 수준의 데이터 타입으로 문자데이터, 숫자데이터, 불데이터가 있습니다. - 문자 데이터 따옴표('...', "...")로 감싼 모든 데이터로 프로그래밍 언어에 따라 문자(character, 1개의 문자로 만든 문자 데이터)와 문자열(String, 여러 개의 문자를 하나의 데이터 세트로 만든 문자 데이터)를 사용합니다. 문자열에 저장된 각각의 문자는 인덱스(Index)로 불리는 숫자로 관리되며, 인덱스를 활용하여 특정 문자를 1개 꺼내 쓰는 인덱싱(Indexing), 여러 개를 한번에 꺼내 쓸 수 있는 슬라이싱..

728x90
반응형