Python

Guide and tips for the very popular programming language. Find practical examples for language elements along with code blocks and functions to solve a variety of problems.

Articles: 24
python programming

Range integer sequences

python programming

Range integer sequences

Range class creates a sequence of integers between start and finish at a specified step value. Decimal non-linear sequences can be generated using formulae and logical blocks.

python programming

Range integer sequences

Range class creates a sequence of integers between start and finish at a specified step value. Decimal non-linear sequences can be generated using formulae and logical blocks.

python views:118
python programming

Sort list with custom attributes

python programming

Sort list with custom attributes

Use custom attributes to sort list items. Order on property functions of class based data structures.

python programming

Sort list with custom attributes

Use custom attributes to sort list items. Order on property functions of class based data structures.

python views:62
python programming

Create or declare new Python lists

python programming

Create or declare new Python lists

Declare an empty list, or generate a flat or nested list with sequence of elements from ranges, strings, dictionary, Numpy arrays or other Python iterables.

python programming

Create or declare new Python lists

Declare an empty list, or generate a flat or nested list with sequence of elements from ranges, strings, dictionary, Numpy arrays or other Python iterables.

python views:133
python programming

Is element in list?

python programming

Is element in list?

Find out if an item belongs to a list and the number of times it occurs.

python programming

Is element in list?

Find out if an item belongs to a list and the number of times it occurs.

python views:132
python programming

Dictionary merge common key groups

python programming

Dictionary merge common key groups

Merge keys and values from multiple dictionaries. Keep all grouped, first, last, or unique values for common keys

python programming

Dictionary merge common key groups

Merge keys and values from multiple dictionaries. Keep all grouped, first, last, or unique values for common keys

python views:125
python programming

Packaging loops with zip

python programming

Packaging loops with zip

Zip incrementally selects values from two or more iterables provided per cycle of a loop. The selected values are combined into a tuple which can be unpacked into multiple variables.

python programming

Packaging loops with zip

Zip incrementally selects values from two or more iterables provided per cycle of a loop. The selected values are combined into a tuple which can be unpacked into multiple variables.

python views:127
python programming

Remove elements by value or index

python programming

Remove elements by value or index

Delete single element from a list by value or index. Remove and return elements at range of indices or discrete positions within list. Filter list for a set of values using comprehension.

python programming

Remove elements by value or index

Delete single element from a list by value or index. Remove and return elements at range of indices or discrete positions within list. Filter list for a set of values using comprehension.

python views:67
python programming

Self-replicate and concatenate lists

python programming

Self-replicate and concatenate lists

A mutable sequence object provides methods to make copies of itself and assign to a new variable or append to itself. Replication is a fast way to generate long sequences, which would otherwise be slower using list comprehension.

python programming

Self-replicate and concatenate lists

A mutable sequence object provides methods to make copies of itself and assign to a new variable or append to itself. Replication is a fast way to generate long sequences, which would otherwise be slower using list comprehension.

python views:69
python programming

Locate matching items in list

python programming

Locate matching items in list

Search for matching items and report first, last or all index positions. Pattern match within list of strings.

python programming

Locate matching items in list

Search for matching items and report first, last or all index positions. Pattern match within list of strings.

python views:71
python programming

Randomly select items from list

python programming

Randomly select items from list

Choose from list randomly with replacement to keep sequence length same, or generate infinite sequences with replacement.

python programming

Randomly select items from list

Choose from list randomly with replacement to keep sequence length same, or generate infinite sequences with replacement.

python views:69