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 |
Tags
- Text mining
- line color
- iterates
- matplotlib.pyplot
- MySQL
- line width
- matplotlib
- polynomial regression
- variables
- error
- PROJECT
- self parameter
- Text Analytics
- break
- pie charts
- continue
- AS
- Github
- For loops
- machine learning
- __init__
- PANDAS
- SQL
- multiple lines
- Default X points
- start exercise
- data distribution
- Else
- Python
- train/test
Archives
- Today
- Total
Data Science Explorer
[Basic Grammar] Python Data Types 본문
반응형
Variables can store data of different types.
Let's check out the data types that Python has.
Text Type | str |
Numeric Types: | int, float, complex |
Sequence Types: | list, tuple, range |
Mapping Type: | dict |
Set Types: | set, frozenset |
Boolean Type: | bool |
Binary Types: | bytes, bytearray, memoryview |
None Type: | NoneType |
When you want to know the data type of the variable, you can use type() function.
Example
x = 9.5
print(type(x))
- Setting the Data Type
Example | Data Type |
x = "Python is fun " | str |
x = 20 | int |
x = 99.9 | float |
x = 1j | complex |
x = ["Nike", "Adidas", "Puma"] | list |
x = ("apple", "banana", "cherry") | tuple |
x = range(6) | range |
x = {"name" : "Grace", "age" : 28} | dict |
x = {"apple", "banana", "cherry"} | set |
x = frozenset({"apple", "banana", "cherry"}) | frozenset |
x = True | bool |
x = b"Hello" | bytes |
x = bytearray(5) | bytearray |
x = memoryview(bytes(5)) | memoryview |
x = None | NoneType |
'Python' 카테고리의 다른 글
[Basic Grammar] Python Casting (0) | 2023.10.20 |
---|---|
[Basic Grammar] Python Numbers (0) | 2023.10.20 |
[Basic Grammar] Python Variables: Output Variables (0) | 2023.10.19 |
[Basic Grammar] Python Variables: Assign Multiple Values (0) | 2023.10.19 |
[Basic Grammar] Python Variables: Variable Names (0) | 2023.10.15 |