Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks
Questions — @dina_ladnyuk
Post #1291
2.38K
PY @python_tasks
Showing posts older than #1292 · Back to latest
a = float('inf')
b = a * 10
c = 10 / a
d = a / 10
print(b, c, d)from math import isinf, isnan
e = float('inf') + float('nan')
g = float('nan') / float('nan')
print(isinf(e), isinf(g), isnan(e), isnan(g))
import math
a = float('inf')
b = float('-inf')
c = a - b
d = a + b
print(math.isinf(c), math.isinf(d), math.isnan(c), math.isnan(d))
a = complex(231, 4076)
b = complex(231, -4076)
c = a * b
print(c.imag)
x = 10
a = format(x, 'b')
b = format(x, 'o')
c = format(x, 'x')
print(a, b, c)
import math
nums = [1e+100, 1, -1e+100]
x = math.fsum(nums)
y = sum(nums)
print(x, y)
from decimal import Decimal
x = 4.2 + 2.1 == 6.3
y = Decimal('4.2') + Decimal('2.1') == Decimal('6.3')
print(x, y)
a = 111.46
b = round(a, -2)
c = round(a, 1)
print(b + c)