by Suf | Dec 20, 2021 | Programming, Python, Tips
In Python, we index lists with numbers. To access an item from a list, you must refer to its index position using square brackets []. Using a tuple instead of a number as a list index value will raise the error “TypeError: list indices must be integers, not...
by Suf | Dec 19, 2021 | Programming, Python, Tips
A Python dictionary is a collection of data values stored in key-value pairs. To access items in a dictionary, you must use the indexing syntax of square brackets [] with the index position. If you use parentheses, you will raise the “TypeError:...
by Suf | Dec 19, 2021 | Data Science, Programming, Python, Tips
numpy is a Python library for manipulating and numerical analysis of large, multi-dimensional arrays. Numpy’s N-dimensional arrays or ndarray is like any regular python array; you access its contents using indexing. To retrieve an item from a ndarray, you must...
by Suf | Dec 18, 2021 | Programming, Python, Tips
Function calls and variable assignments are distinct operations in Python. Variable assignments are helpful for code structure, and function calls help reuse code blocks. To assign the result of a function to a variable, you must specify the variable name followed by...
by Suf | Dec 18, 2021 | Programming, Python, Tips
Functions are blocks of code that work and behave together under a name. Built-in functions have their functionality predefined. To call a built-in function, you need to use parentheses (). If you do not use parentheses, the Python interpreter cannot distinguish...