개념 정리
-
[Python] 놓치기 쉬운 개념들 정리Programming Language/Python 2021. 4. 15. 15:29
# 2진수, 8진수, 16진수로 정수 표현하기 >>> 0b110 # 2진수 6 >>> 0o10 # 8진수 8 >>> 0xF # 16진수 15 # 보다 정교한 계산으로 부동소수점 오류를 피하는 자료형 Decimal from decimal import Decimal cost_of_gum = Deciaml('0.10') cost_of_gumdrop = Decimal('0.35') cost_of_transaction = cost_of_gum + cost_of_gumdrop print(cost_of_transaction) # Returns 0.45 instead of 0.44999999999999996 # 빈 변수 만들기 >>> x = None # 다른 언어의 null 값 >>> print(x) None # de..