Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 5788

Python

Reductions and statistics

Reduce a finite sample to a total or a statistic suited to the question.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Regular expressions

A pattern describes text structure and fullmatch requires the entire string to match.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Scope and lifetime

Scope determines where a name can be resolved, while references can keep an object alive beyond a function call.

Basic · Python 3.14; repository image, production runtime not attested
Python

Trust boundaries and input validation

At an input boundary, bound the size before parsing and validate the resulting value against application rules.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Sorting and comparison

Sort records by a key that is computed once per input element.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Unicode text and bytes

A str is an immutable sequence of Unicode code points, while bytes hold encoded octets.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Testing and assertions

A test compares observed behavior to an expectation, including values on either side of a boundary.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Dates, instants and durations

Represent calendar dates separately from instants with a UTC offset and durations with timedelta.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Type conversion

A type constructor converts a value according to its own rules and raises an exception for unsupported input.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Type system

Every object has a type that determines its operations, while a parameter annotation imposes no automatic runtime type check.

Basic · Python 3.14; repository image, production runtime not attested
Python

Type annotations and protocols

An annotation can describe the interface a static checker expects without requiring a shared base class.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Variables and name binding

Assignment to a name binds it to the right-hand object without copying that object.

Basic · Python 3.14; repository image, production runtime not attested
Python

Ellipsis / ...

The three-dot literal denotes the singleton Ellipsis, which can be recognized by identity.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

NotImplemented

NotImplemented is a singleton that an operator method can return to decline an operand pairing.

Intermediate · Python 3.14; repository image, production runtime not attested
Python

Attach and detach logging handlers with addHandler

Inspect the handlers attached directly to a logger, attach a configured handler with `addHandler()`, and empty the list through `removeHandler()` rather than editing it directly.

Advanced · Python 3.12
Python

The `*args` parameter: collecting positional arguments

In a function definition, `*args` collects leftover positional arguments into a tuple. In the call `fn(*args)`, the star does the reverse: it passes the tuple’s items as separate positional arguments.

Advanced · Python 3.12
Python

Testing exceptions with assertRaises

Use `unittest.TestCase.assertRaises` in callable form or in a `with` block to check that an operation raises the expected exception.

Intermediate · Python 3.12
Python

Appending to the right of a `deque`

`collections.deque.append` adds one item to the right end of a double-ended queue. In this sliding-window example, the monotonic queue stores indices rather than the values themselves.

Advanced · Python 3.12
Python

`deque.pop()` — remove the rightmost item

`deque.pop()` removes and returns the rightmost item of a double-ended queue. Use it to discard dominated candidates when computing a sliding-window maximum.

Advanced · Python 3.12
Python

Remove the leftmost item with deque.popleft()

`popleft()` removes and returns the first item in a deque. In a sliding window, it lets you discard indices that fall before the window’s left boundary.

Advanced · Python 3.12