| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 동적 프로그래밍
- Deque
- Recommendation
- isdigit()
- 우선순위 큐
- 프로그래머스
- knowledge
- Knowledge graph
- 파이썬
- 알고리즘
- 추천시스템
- DP
- explainable recommendation
- isnumeric()
- 자료구조
- 그래프
- isalpha()
- 백준
- 그래프 탐색
- Stack
- find()
- 정렬
- isalnum()
- Algorithm
- bfs
- 코테
- LSTM
- kg
- Python
- Dynamic Programming
Archives
- Today
- Total
목록import math (1)
데린이 고인물되기
[TIL] 250916 - 파이썬 반올림 / 올림 / 내림 / 버림
1. 반올림 (round)round(x) : 가장 가까운 정수로 반올림import math를 사용하지 않음print(round(3.5)) # 4print(round(2.5)) # 2 (주의!)print(round(2.675, 2)) # 2.67 (부동소수점 특성)주의파이썬의 round는 "Banker's Rounding" (또는 Round half to even) 규칙을 사용딱 .5로 끝나는 경우, 가까운 짝수 정수 쪽으로 반올림함. 그래서 :print(round(1.5)) # 2 (짝수로 감)print(round(2.5)) # 2 (짝수로 감)print(round(3.5)) # 4 (짝수로 감) 2. 올림 (math.ceil)항상 큰 정수로 올림import mathprint(math.ceil..
Algorithm/정리
2025. 9. 17. 00:28