반응형
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 |
Tags
- 파이썬
- Tkinter
- SQL
- hive
- Redshift
- Google Spreadsheet
- string
- list
- django
- Mac
- Kotlin
- Python
- google apps script
- numpy
- array
- dataframe
- math
- matplotlib
- PostgreSQL
- gas
- PANDAS
- c#
- Google Excel
- Apache
- PySpark
- Github
- Java
- Excel
- GIT
Archives
- Today
- Total
목록fabs (1)
달나라 노트
Python math : fabs (절대값)
math library의 fabs() method는 절대값을 return합니다. Syntax math.fabs(x) 예시를 봅시다. import math print(math.fabs(-10)) print(math.fabs(5)) print(math.fabs(-10.6)) -- Result 10.0 5.0 10.6 위 결과를 보면 fabs() method의 인자로 전달된 숫자에서 부호가 모두 사라지고 절대값이 return된 것을 볼 수 있습니다. 여기서 한가지 눈여겨볼건 fabs(-10), fabs(5)의 return값이 각각 10.0, 5.0입니다. 정수를 전달했는데 float type의 숫자가 return되었습니다. 따라서 fabs() method는 결과를 float type으로 return합니다.
Python/Python math
2022. 11. 8. 20:01