Blog
How to Get Unique Values from List in Python
Python lists can store duplicate values. If you want to extract the unique values in a list, there are several ways to do this, and this tutorial will go through each of them with code examples. Table of contentsGet Unique Values from List Using set()Get Unique Values...
How to Install MySQL on Mac
This tutorial will go through how to install MySql on MacOS using the Homebrew package manager. Table of contentsInstall HomebrewInstall MySQL Start MySQLConnect to MySQLAlternatives to Homebrew Install Homebrew You can skip this step if you already have Homebrew...
How to Solve Python TypeError: not enough arguments for format string
The error TypeError: not enough arguments for format string occurs if the number of arguments you specify during string formatting is not equal to the number of values you want to add to the string. The error can also occur if you forget to enclose the values for...
How to Sort a List of Tuples in Python
In Python, you can sort a list of tuples by the elements of each tuple. This tutorial will go through how to sort a list of tuples with code examples. Table of contentsUsing the sort() MethodSorting List of Tuples by First Element using sort()Sorting List of Tuples by...
What is the Difference Between List and Tuple in Python?
List and tuple are two of the four built-in data types for storing data in Python. The list type is a dynamic, mutable data structure, whereas a tuple is a static, immutable data structure. This tutorial will cover the differences between a List and Tuple in Python....
How to Count Occurrences of an Element in a Python List
This tutorial will go through how to use Python to count how often different items appear in a given list. You will learn how to do this using the count() list method, the naive implementation, the Counter() method from the collections library, values_count() from the...
How to Convert a List to a String in Python
If you need to convert a list to a string in Python, there are several straightforward ways to do so. This tutorial will go through how to convert a list to a string with the different approaches with code examples. Table of contentsConvert a List to a String Using...
How to Remove Empty Strings from a List of Strings in Python
If you need to remove empty strings from a list of strings in Python, there are several ways to do so. You can use the built-in methods remove(), join() and split() together, and filter(). You can also remove empty strings using list comprehension. This tutorial will...
How to Find the Length of a List in Python
The length of a Python list is the same as the number of items in the list. You can find the length of a list using the built-in len() function. You can also use a for loop to iterate over the list and count the number of items. This tutorial will go through...
How to Calculate the Cartesian Product in Python
The Cartesian product of two sets A and B denoted A x B is the set of all possible ordered pairs (a, b), where a is in A and b is in B. We can get the Cartesian product between two lists saved as a 2D list in Python. This tutorial will go through different methods to...
Suf is a senior advisor in data science with deep expertise in Natural Language Processing, Complex Networks, and Anomaly Detection. Formerly a postdoctoral research fellow, he applied advanced physics techniques to tackle real-world, data-heavy industry challenges. Before that, he was a particle physicist at the ATLAS Experiment of the Large Hadron Collider. Now, he’s focused on bringing more fun and curiosity to the world of science and research online.