Zip & Unzip: How Does It Work in Python?

The zip() function takes a number of iterables and aggregates them to a single one by combining the i-th values of each iterable into a tuple. For example, zip together lists [1, 2, 3] and [4, 5, 6] to [(1,4), (2,5), (3,6)]. You can unzip this list of tuples by calling zip(*list) using the unpacking … Read more

Recursion: A Helpful Guide in Python

Recursion is a powerful tool in your coding toolbox. Understanding it is a key skill on your path to mastery. This article gives you a thorough introduction to this important computer science concept. What is Recursion? What’s a Simple Example for Recursion? What’s Mutual Recursion? What is Recursion? Stephen Hawking used a concise explanation: “to … Read more

Python: “0.1 + 0.2 ≠ 0.3”. Me: “?”

Python Representation Error: This article explains why floating-point arithmetic can lead you astray in Python. Floating-point arithmetic cannot represent some numbers precisely. While many people think it’s a bug, it’s actually not. Have a look at the following code snippet: In the code snippet, you have assumed that the number 0.1 actually represents the decimal … Read more

How to Embed a Python Interpreter in Your Website?

Want to make your website more interactive? Embed a Python interpreter into your website! This does not only increase the interactivity and usability of your website — and create happy users for your web business. It also increases the average time spent on your website because people will try out things. So it’s actually a … Read more