int1 Decimal과 float 타입은 연산이 안됨 Decimal과 float 타입은 연산이 안됨Decimal과 int 타입은 직접 연산할 수 있지만, Decimal과 float 타입을 직접 더할 수 없기 때문입니다.🧨 오류 메시지 해석TypeError: unsupported operand type(s) for +: 'decimal.Decimal' and 'float'a + 3.2에서:a는 Decimal3.2는 float파이썬은 Decimal + float을 허용하지 않음정확성 보장을 위해 서로 다른 실수 타입은 자동 변환하지 않습니다✅ 해결 방법: 둘 다 Decimal로 통일방법 1: 숫자를 Decimal로 변환from decimal import Decimala = Decimal('35.72')b = Decimal('3.2')a + Decimal(b).. 2025. 4. 25. 이전 1 다음