What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-07 13:51:13
how to handle zero division error python
import decimal from enum import Enum from gw_utility.logging import Logging from mpmath import mpf class NumberType(Enum): """Specifies number type or library used for calculating values.""" INTEGER = 1 FLOAT =... Add solution -
Python 2021-10-06 12:24:02
how to lag python
Evil! Anyway... print(9**9) is easily manageable for python. On a faily fast computer, it will only take a few milliseconds for the output to appear: 387420489. Check it against a calculator. Not bad. So let's punish our interpreter properly. print(9*... Add solution -
Python 2021-09-24 12:41:04
high precision, decimal, float, mpmath
#!/usr/bin/python from decimal import Decimal, getcontext import math import mpmath getcontext().prec = 50 mpmath.mp.dps = 50 num = Decimal(1) / Decimal(7) num2 = mpmath.mpf(1) / mpmath.mpf(7) print(" math.sqrt: {0}".format(Decimal(math.s... Add solution