Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 타이타닉 데이터
- 파이썬 제어문
- 머신러닝
- Data pre-processing
- control statement
- 파이썬 객체 지향 프로그래밍
- 배열
- 판다스
- ML
- 파이썬 크롤링
- 제어문
- python
- 사이킷런
- sklearn
- scikit-learn
- dataframe
- NumPy
- Naive Bayes
- 나이브베이즈
- 순회 크롤러
- pandas
- 파이썬 크롤러
- K평균군집화
- 넘파이
- python control statement
- KMeans Clustering
- Machine Learning
- 파이썬
- Python crawler
- Titanic data set
Archives
- Today
- Total
Try to 개발자 EthanJ의 성장 로그
Python Data type (int, float) 파이썬 자료형 (정수, 실수) 본문
CS & DS/Basic Python with Data Crawling
Python Data type (int, float) 파이썬 자료형 (정수, 실수)
EthanJ 2022. 10. 4. 17:38Python Data type (int, float) 파이썬 자료형 (정수, 실수)
Why 숫자형부터 시작?
- 컴퓨터가 이해할 수 있는 단 하나의 언어: 기계어(machine language) with 0, 1
> 숫자형
- 종류
- 정수: 0, 양의 정수, 음의 정수
- 실수: 소수점을 포함하는 숫자
- 8진수 (0o or 0O로 시작): e.g. 0o34, 0o25
- 16진수 (0x로 시작): e.g. 0x2A, 0xFF
- 2진수 (0b로 시작): e.g. 0b10, 0b11
- 8bit == 1byte
1) 정수형 (int)
#양수, 음수, 0
a = 10
b = -20
c = 0
# 출력 함수 > print(변수명)
print(a)
10
# print(string) > string " "안의 내용 출력
print("a")
a
print("Hello world")
Hello world
# data type을 확인하는 함수 > type()
type(a)
int
type(b)
int
type(c)
int
2) 실수형 (float)
# 실수 data type == float
a = 1.3
b = -2.4
c = 0.0
# 실수 타입 확인
type(a)
float
type(b)
float
type(c)
float
# 0 vs 0.0
print(type(0), type(0.0))
<class 'int'> <class 'float'>
# 정수와 실수가 다른 숫자로 인식되는 이유: 2의 보수(정수) vs floating point(실수)
'CS & DS > Basic Python with Data Crawling' 카테고리의 다른 글
Python Data type (list) 파이썬 자료형(리스트) (1) | 2022.10.08 |
---|---|
Python Data type (string) 파이썬 자료형 (문자열) (1) | 2022.10.06 |
Python Baekjoon Online Judge 파이썬 백준 온라인 저지 용어 및 입출력 코드 (0) | 2022.10.06 |
Python Operator 파이썬 연산자 (1) | 2022.10.06 |
Python 파이썬 Jupyter Notebook 사용법 (0) | 2022.10.04 |
Comments