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
- polynomial regression
- AS
- Text mining
- iterates
- self parameter
- line width
- line color
- matplotlib.pyplot
- machine learning
- Text Analytics
- Else
- Github
- Python
- PANDAS
- Default X points
- SQL
- __init__
- data distribution
- variables
- break
- error
- continue
- start exercise
- multiple lines
- matplotlib
- train/test
- MySQL
- PROJECT
- pie charts
- For loops
Archives
- Today
- Total
Data Science Explorer
[Basic Grammar] Python Math 본문
반응형
- Built-In Math Functions
The min() and max() functions can be used to find the lowest or highest value.
Example
x = min (3,10, 1)
y = max (3,10, 1)
print(x)
print(y)
The abs() function returns the absolute (positive value) of the specified number.
Example
x = abs(-8.25)
print(x)
The pow(x,y) function returns the value of x to the power of y.
Example
Return the value of 4 to the power of 2.
x = pow(4, 2)
print(x)
- The Math Module
The module called math extends the list of math functions.
Example
import math
x = math.sqrt(3)
print(x)
The math.ceil() rounds a number upwards to its nearest integer and math.floor() rounds a number downwards to its nearest integer.
Example
import math
x = math.ceil(1.2)
y = math.floor(1.2)
print(x) # returns 2
print(y) # returns 1
The math.pi constant, returns the value of PI (3.14...):
Example
import math
x = math.pi
print(x)
'Python' 카테고리의 다른 글
[Exercise] Functions (0) | 2024.04.05 |
---|---|
[Basic Grammar] Datetime (0) | 2023.11.23 |
[Basic Grammar] Modules (1) | 2023.11.22 |
[Basic Grammar] Python Inheritance (0) | 2023.11.21 |
[Basic Grammar] Python Classes/Objects (1) | 2023.11.19 |