728x90 pow1 [python] 파이썬에서 제곱사용할 시 pow(), math.pow(), ** type 차이 파이썬을 사용할 때 제곱을 표현하는 방법은 여러가지가 있다. math.pow(2,3)pow(2,3)2**3 정수형 숫자의 거듭제곱에서 math.pow만 float 형태로 출력# pow 사용print(pow(2,3)) # 8# math.pow 사용import mathprint(math.pow(2,3)) # 8.0# ** 사용print(2**3) # 8 Float 숫자의 거듭제곱에서 모 float 형태로 출력# pow 사용print(pow(2.0,3)) # 8.0 # Time: 2.384185791015625e-05import math# math.pow 사용print(math.pow(2.0,3)) # 8.0 # Time: 1.049041748046875e-05# ** 사용print((2.0)**3) # 8... 2025. 3. 17. 이전 1 다음 728x90