Algorithms, functions, classes, regular expressions, iterators, generators, OOP, exceptions, NumPy, pandas, scikit-learn
https://telega.in/c/python_tasks
Questions — @dina_ladnyuk
Post #2401
1.24K
- 👍 1
PY @python_tasks
Showing posts older than #2402 · Back to latest
a = hasattr(bytes(), "lower")
b = hasattr(bytes(), "pop")
c = hasattr(bytearray(), "lower")
d = hasattr(bytearray(), "pop")
print(a, b, c, d)
d1 = {}
d2 = {}
d1.get("x", 2)
d2.setdefault("x", 2)
print(d1 == d2)sum(bytes(b"abCD")) - sum(bytes(b"ABcd"))
chr('b') - chr('a')b = bytearray(b"aBcD5")
a1 = b.isalpha()
b.pop()
a2 = b.isalpha()
print(a1, a2)
d = {}
x1 = d.get("x", 1)
x2 = d.setdefault('x', 2)
x3 = d.get("x", 3)
x4 = d.setdefault('x', 4)
print(x1, x2, x3, x4, sum(d.values()))x = b"hello"
a = str(x, encoding='ascii') == str(x, encoding='utf-8')
b = str(x) == str(x, encoding='utf-8')
print(a, b)
b = bytearray()
b.extend(b"hello")
s = b.title().decode()
print(s)
chr(ord("a") + len("Привет".encode()) - len("hello".encode()))