랭귀지/python
python round를 이용한 소수점 반올림
유키공
2018. 11. 11. 19:37
파이썬에서 round를 이용한 소수점 반올림
print(round(3.4444))
결과 : 3.0
print(round(3.4444, 2)) 결과 : 3.44
print(round(3.5)) 결과 : 4.0
print(round(3.5555, 2)) 결과 : 3.56
print('%.2f' % 2.555) 결과 : 2.56
print(round(3.4444, 2)) 결과 : 3.44
print(round(3.5)) 결과 : 4.0
print(round(3.5555, 2)) 결과 : 3.56
print('%.2f' % 2.555) 결과 : 2.56