Answers for "python constants"

1

python cmath constants

cmath.e	Returns Euler's number (2.7182...)
cmath.inf	Returns a floating-point positive infinity value
cmath.infj	Returns a complex infinity value
cmath.nan	Returns floating-point NaN (Not a Number) value
cmath.nanj	Returns coplext NaN (Not a Number) value
cmath.pi	Returns PI (3.1415...)
cmath.tau	Returns tau (6.2831...)
Posted by: Guest on January-04-2021
3

python constant

class CONST(object):
    __slots__ = ()
    FOO = 1234


CONST = CONST()

print(CONST.FOO)  # 1234

CONST.FOO = 4321  # AttributeError: 'CONST' object attribute 'FOO' is read-only
CONST.BAR = 5678  # AttributeError: 'CONST' object has no attribute 'BAR'
Posted by: Guest on May-13-2021
0

python e constant

The constant e can be used when you 
import math
.
The e refers to euler''s (oiler''s) constant. It is approximately 2.71828.
print(math.e)
#2.718281828459045
It is very useful when you want to make logarithms, as LOG10E has some good uses.
math.e is fixed, and thus does not change.
Posted by: Guest on July-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language