Quiz Catalog

Catalog of quizzes

a = bytes(range(3)).hex()

print(a)
000102
  • byte
  • byte/operation/hex
  • build-in/range

a = (el for el in range(5))
b = (el for el in range(7, 13, 2))
t = (a, b)
print(t)
(<generator object <genexpr> at 0x7f8f46f245f0>, <generator object <genexpr> at 0x7f8f46d255b0>)
  • build-in/range
  • tuple
  • generator

x1 = [i for i in range(10) if i % 2 and i % 3]
x2 = x1
x2.append(e for e in range(8) if e not in x1)

print(x1)
[1, 5, 7, <generator object <genexpr> at 0x7f18ad923f40>]
  • list/comprehension
  • build-in/append
  • build-in/range
  • generator

a = False

for x in range(1, 3):
  a = not a

print(a)
False
  • boolean/literal
  • boolean/operation/not
  • build-in/range

a = (1, 2, 3, 2, 1)
b = range(1, 6)

for x in b:
  if a.__contains__(x):
    a += (a.count(x),)

print(a)
(1, 2, 3, 2, 1, 2, 3, 2)
  • tuple/operation/contains
  • tuple/operation/count
  • build-in/range

lst = [1, 2, 3, 4]

r = 1

for i in range(len(lst)):
  r *= i

print(r)
0
  • build-in/range

print(list(range(2, 15, 3)))
[2, 5, 8, 11, 14]
  • build-in/range
  • build-in/list