by Suf | Jan 23, 2022 | Programming, Python, Tips
The max() function is built into Python and returns the item with the highest value in an iterable or the item with the highest value from two or more objects of the same type. When you pass an iterable to the max() function, such as a list, it must have at least one...
by Suf | Jan 22, 2022 | Programming, Python, Tips
If you define an array and try to index it with more dimensions than the array has, you will raise the error: IndexError: too many indices for array. You need to recheck the array’s dimensions and index it with those dimensions to solve this error. This tutorial...
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...