Python's built-in enumerate function simplifies iteration with a counter. Here we show how it's used and build it from scratch using iterators.
Python Tuples - Basics, examples, unpacking, tuples vs. lists
In Python, tuples are a sequence data type, very similar to lists. We create tuples by using a comma-separated list of values.
How to print to stderr in Python
In order to have Python print to stderr , we'll need to point the print function to the sys.stderr file. It's done slightly differently in Python 3 than in Python 2.
The Zen of Python - Principles and History
The Zen of Python is a set of 19 principles written by Tim Peters. They were written to capture the guiding principles behind the design decisions for the early versions of the language.
Priority Queue in Python
Priority queue is a data structure similar to a regular queue, but where elements have priorities assigned. Python comes with a built-in PriorityQueue class contained in the queue module.
Python Swap - How to Swap Two Variables the Python Way
It's simple. For any two variables (a, b) we can swap their values in a single assignment statement
Calculating Variance in Python - Explained
You have a list of numbers and you want to calculate its variance. Here are the methods to do that in Python.
Python sort lambda - How to sort with lambda key function in Python
Sorting in Python is simple. You'll pass a list, dict or set to the built-in function sorted. Using the key parameter allows us to modify the default sorting behavior.
Leetcode Two Sum - The Optimal Solution in Python
Two Sum is a rather famous coding interview problem, often
JSONPath in Python - Examples, Syntax and Tutorial
What is JSONPath? JSONPath is a query language for selecting