by Suf | Jan 29, 2022 | Programming, Python, Tips
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...
by Suf | Jan 28, 2022 | Programming, Python, Tips
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...
by Suf | Jan 28, 2022 | Programming, Python, Tips
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....
by Suf | Jan 27, 2022 | Programming, Python, Tips
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...
by Suf | Jan 26, 2022 | Programming, Python, Tips
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...
by Suf | Jan 26, 2022 | Programming, Python, Tips
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...