by Suf | Dec 15, 2021 | Programming, Python, Tips
Python raises ValueError when a function receives an argument with a correct type but an invalid value. Python valueerror: too many values to unpack (expected 2) means you are trying to access too many values from an iterator. In this tutorial, we will go through what...
by Suf | Dec 14, 2021 | Programming, Python, Tips
You will encounter the TypeError: ‘NoneType’ object is not callable if you try to call an object with a None value like a function. Only functions respond to function calls. In this tutorial, we will look at examples of code that raise the TypeError and...
by Suf | Dec 14, 2021 | Programming, Python, Tips
In Python, we can only compare objects using mathematical operators if they are the same numerical data type. Suppose you use a comparison operator like the greater than the operator or >, between a string and an integer. In that case, you will raise the TypeError:...
by Suf | Dec 13, 2021 | Programming, Python, Tips
We raise the TypeError: ‘int’ object is not subscriptable when trying to treat an integer type value like an array. Subscriptable objects in Python contain or can contain other objects in order, for example, a list. Integers cannot contain other objects;...
by Suf | Dec 9, 2021 | Data Science, Programming, Python, Tips
Hamming distance is a type of string metric for finding how similar two binary data strings are. If the strings are equal in length, Hamming distance determines the number of bit positions different between them. We can also describe Hamming distance as the minimum...
by Suf | Dec 8, 2021 | Programming, Python, Tips
Python has several functions that are pre-defined in Python, known as built-in functions. These functions provide convenience and are very easy to use. In this tutorial, we will be looking at the abs() built-in function to calculate the absolute value of a number. As...