본문 바로가기

Python/Python Programming

Part 03 Ch01 파이썬 프로그래밍- 03. Data Type(이론)

Data type


Data Type: 프로그래밍 언어가 이해하는 사용자(프로그래머)의 데이터의 사용의도를 정의한 것.

 

https://en.wikipedia.org/wiki/Data_type#/media/File:Python_3._The_standard_type_hierarchy.png

 

 

  • 데이터 타입은 프로그래밍 언어마다 조금씩 다릅니다. 
  •  --> 프로그래밍 언어마다 목적이 조금식 다르기 때문입니다.
  • 위의 그림은 Python3에 정의되어 있는 Data Type들을 다룬 것입니다. 
  • 데이터 타입은 우리가 사용하는 데이터를 컴퓨터가 이해할 수 있게 규격화 한 것입니다. 
  • 컴퓨터는 정의된 데이터 타입을 통해서 해당 수치값이 어떤 의미인지 이해하고 계산할 있게 됩니다.

 

Python Data Types


 저희가 수업에서 다루게 되는 Python의 data type들은 다음과 같습니다. 

  • int: 정수
  • float: 실수(소수)
  • str: 문자열(character sequence)
  • list: 자유롭게 변경이 가능한 여러 개의 데이터 묶음
  • tuple: 생성 후에 변경이 불가능한 여러 개의 데이터 묶음
  • set: 집합
  • dict: key-value store 방식을 가지고 자료를 저장하는 구조

 

요약

  • 파이선에서 다루고 있는 data type들에는 int, float, str, list, tuple, set, dict 등이 있습니다.
  • data type은 프로그래밍을 할 때 기본이 되는 데이터(재료)를 담을 수 있는 그릇을 정의한 겁니다.

Hands-on

1. 파이썬 공식 문서에서 Python Data type에 대한 설명을 읽어보자

https://docs.python.org/3/library/stdtypes.html

 

Built-in Types — Python 3.10.5 documentation

Built-in Types The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some collection classes are mutable. The methods that

docs.python.org