by Suf | Dec 23, 2021 | Programming, Python, Tips
Floats and iterables are distinct objects In Python. A float is any decimal point number, and an iterable is an object capable of returning elements one at a time, for example, a list. A float is a single value and does not contain other values. If you try to iterate...
by Suf | Dec 23, 2021 | Programming, Python, Tips
In Python, the return keyword ends the execution flow of a function and sends the result value to the main program. You must define the return statement inside the function where the code block ends. If you define the return statement outside the function block, you...
by Suf | Dec 22, 2021 | Programming, Python, Tips
In Python, a dictionary is stores data in key:value pairs. Python 3.7 dictionaries are ordered data collections; Python 3.6 and previous dictionaries are unordered. In a Python dictionary, all keys must be hashable. If you try to use the unhashable key type...
by Suf | Dec 22, 2021 | Programming, Python, Tips
In Python, a function is a block of code that only runs when called. You can pass data, known as parameters or arguments, to a function, and a function can return data as a result. To call a function, you must use the function name followed by parentheses () and pass...
by Suf | Dec 21, 2021 | Programming, Python, Tips
The square of a number results from multiplying a number by itself. The square of the number is the same as raising the number to the power of two. For example $latex 8 \times 8 = 64$, which is equal to $latex 8^{2}$ as well. The square of real numbers is always...
by Suf | Dec 21, 2021 | Programming, Python, Tips
In Python, a dictionary is stores data in key:value pairs. Python 3.7 dictionaries are ordered data collections; in Python 3.6 and previous dictionaries are unordered. You cannot perform a slice on a Python dictionary like a list. Dictionaries can have custom key...