Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 데이터 타입 종류
- - 부울
- - 정수
- - 실수
- - 문자열
- ## 변수 타입 확인
- ```python
- type(variable_name)
- type(58)
- type(29.9)
- type('float')
- ```
- ## 예약어
- - False
- - None
- - True
- - and
- - as
- - assert
- - break
- - class
- - continue
- - def
- - del
- - elif
- - else
- - except
- - finally
- - for
- - from
- - global
- - if
- - import
- - in
- - is
- - lambda
- - nonlocal
- - not
- - or
- - pass
- - raise
- - return
- - try
- - while
- - with
- - yield
- ## 숫자
- 파이썬의 숫자 데이터는 정수와 부동소수점이 있다.
- 연산자|설명
- ---|---
- +|더하기
- -|빼기
- *|곱하기
- /|부동소수점
- //|정수 나누기(소수점 이하 버림)
- %|나머지
- **|지수
- ### 진수
- - 2진수(binary): 0b 혹은 0B
- - 8진수(octal): 0o 혹은 oO
- - 16진수(hex): 0x 혹은 0X
- ### 형변환
- ```python
- int(True) # 1
- int(False) # 0
- int(98.6) # 98
- int(1.0e4) # 10000
- int('99') # 99
- int('-23') # -23
- int('+12') # 12
- int('99 bottles') # error
- int('98.6') # error
- int('1.0e4') # error
- ```
- ### 부동소수점수
- ```python
- flaot(True) # 1.0
- float(False) # 0.0
- float(98) # 98.0
- float('99') # 99.0
- float('98.6') # 98.6
- float('-1.5') # -1.5
- float('1.0e4') # 10000.0
- ```
Add Comment
Please, Sign In to add comment