program/python

[python] 버림나눗셈 // floor division

momoa210 2024. 1. 27. 23:57

소수점을 자동으로 버리는  floor division

print(7//2) --> 3

 

print(7/2) --> 3.5 

 

// 파이썬은 소수가 더 강함 

 

print(8.0//3) --> 2.0

// 하나라도 소수 이면 소수로 표현

 

print(round(3.14334544654, 2) ) --> 3.14

 

print(round(3.14334544654) ) --> 3

 

print(2**3) --> 8  출력 2의 3제곱

'program > python' 카테고리의 다른 글

[python] type 함수  (0) 2024.01.28
[python] fomat 다루기  (0) 2024.01.28
[python] 문자열 포맷팅  (1) 2024.01.28
[python] 형변환  (0) 2024.01.28
[python] 문자열  (0) 2024.01.28