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
- matplotlib
- Python
- line color
- Github
- polynomial regression
- train/test
- self parameter
- PANDAS
- iterates
- error
- __init__
- For loops
- pie charts
- multiple lines
- AS
- Default X points
- continue
- Text mining
- matplotlib.pyplot
- MySQL
- Text Analytics
- PROJECT
- break
- machine learning
- SQL
- line width
- data distribution
- Else
- start exercise
- variables
Archives
- Today
- Total
Data Science Explorer
[Basic Grammar] Python Numbers 본문
반응형
There are three numeric types in Python which are int(), float(), complex().
- Int()
It is a whole number, positive or negative (without decimals).
Example
x = 2
y = -2
print (x)
print (y)
- Float()
It is a number, positive or negtiave, containing one or more decimals.
Example
x = 1.89
print(type(x))
Example
= 35e3
y = -67.7e100
print(type(x))
print(type(y))
- Complex()
They are numbers that are written with a "j" as the imaginary part.
x = 9+5j
Y = -5j
print(type(x))
print(type(y))
Exercises
Insert the correct Python syntax to convert the variable x into a floating-point number.
x = "3.14"
x = float(x)
'Python' 카테고리의 다른 글
[Basic Grammar] Python If ... Else (0) | 2023.10.20 |
---|---|
[Basic Grammar] Python Casting (0) | 2023.10.20 |
[Basic Grammar] Python Data Types (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 |