by Suf | Mar 8, 2022 | Programming, Python, Tips
We use dictionaries to store data values in key:value pairs in Python. The dictionary method has_key() returns True if a specified key is present in the dictionary. Otherwise, it returns False. As of Python major version 3, has_key was removed from the dictionary...
by Suf | Mar 7, 2022 | Programming, Python, Tips
The built-in Python function round() returns a rounded version of a specified floating-point number to a specified number of decimal places. The round() function does not belong to the float data type. If you try to call the round() method on a floating-point number,...
by Suf | Mar 6, 2022 | Programming, Python, Tips
In Python, the list data structure stores elements in sequential order. We can use the dictionary items() method to return a view object containing the key-value pairs of a dictionary. However, we cannot apply the items() method to a list. If you try to use...
by Suf | Mar 6, 2022 | Programming, Python, Tips
In Python, the list data structure stores elements in sequential order. We can use the dictionary values() method to return a view object containing the dictionary’s values as a list. However, we cannot apply the values() method to a list. If you try...
by Suf | Mar 6, 2022 | Programming, Python, Tips
In Python, the list data structure stores elements in sequential order. We can call the dictionary get() method to return the item’s value with the specified key. However, we cannot call the get() method on a list. If you try to call...