Python Snippets
The Python snippet collection contains helper functions for Python 3.6. It includes utilities for most common data types, such as primitivies, lists, dictionaries and date objects.
Learn 3 easy ways to swap the values of two variables in Python.
Calculates the date of
n
days from the given date.Checks if all elements in a list are equal.
Checks if all the values in a list are unique.
Generates a list of numbers in the arithmetic progression starting with the given positive integer and up to the specified limit.
Calculates the average of two or more numbers.
Calculates the average of a list, after mapping each element to a value using the provided function.
Splits values into two groups, based on the result of the given
filter
list.Splits values into two groups, based on the result of the given filtering function.
Calculates the number of ways to choose
k
items fromn
items without repetition and without order.Returns the length of a string in bytes.
Converts a string to camelcase.
Capitalizes the first letter of a string.
Capitalizes the first letter of every word in a string.
Casts the provided value as a list if it's not one.