by Suf | Jan 22, 2022 | Programming, Python, Tips
When you want to access a value inside a list, you must use an index value in the range of the list. Using an index value out of range will raise the error: IndexError: list index out of range. You can solve this index error by using the range function on the length...
by Suf | Jan 21, 2022 | Programming, Python, Tips
This error occurs when you define a function with a non-default parameter following a default parameter. If positional parameters follow a default parameter, the Python interpreter cannot know if you passed an argument for the default parameter or for one of the...
by Suf | Jan 21, 2022 | Programming, Python, Tips
There are two types of arguments in Python: keyword and positional arguments. The syntax of Python requires that these types of arguments appear in a particular order. If you place a positional argument after a keyword argument, the Python interpreter will throw the...
by Suf | Jan 19, 2022 | Programming, Python, Tips
In Python, we use __init__() as a constructor function when creating an object of a class. This function allows you to pass arguments to a class object. If you misspell the __init__ function, you will encounter the error: TypeError: object() takes no arguments. To...
by Suf | Jan 18, 2022 | Programming, Python, Tips
The Python map() function applies a function on all items in an input iterable object. The iterable object can be a list, a tuple, a set, dictionary or a string. The map() function returns an iterable map object, which you will have to iterate over using a for loop or...