Python ord function example
The ord() is a built-in function in Python that returns the Unicode code from a given character. In other words, this function accepts a single char as an…
Press Esc to close
Archive
The ord() is a built-in function in Python that returns the Unicode code from a given character. In other words, this function accepts a single char as an…
The bytearray() function in Python returns a new array of bytes. The bytearray class is a mutable sequence of integers in 0 to 256. However, it has most…
The range() is a built-in function in Python that returns the sequence of numbers between the specified range. This function is preferred over a list when we want…
Python exec() function: The Python exec() function is a built-in function that supports the dynamic execution of Python code. However, the parameter must be either a string or…
Python any() function: The Python any() function returns true if any of the elements in iterable(List, Dictionary, Tuple, Set) is true or non zero. However, if all values…
Python compile function: The compile() is a built-in function in Python that takes source code as input and returns a ready to execute code or AST object. Moreover,…
Python Built-in Function callable(): The callable() is a built-in function in Python that determines if the object being passed is callable or not. However, this method returns True…
Python Dict setdefault(): The setdefault() method returns the value of the given key from the dictionary. However, it adds a new key with a given default value in…
Python Dictionary popitem(): The popitem() method removes the last inserted key-value pair from the dictionary and returns it as a tuple. However, if we call this method on…
The update() method updates the dictionary with the key-value pairs from the other dictionary. However, If the same key is present in the source dictionary, it overwrites the…
Python get keys from dict: The keys() method returns a new view of the dictionary keys as a list referred as "dict_keys". Method signature The signature for the…
Python read values from dict: The values() method returns a new view of the dictionary values as a list referred to as "dict_values". Since this is a view…
Python read items from dict: The items() method returns a new view of the dictionary items as a list of tuples referred as "dict_items" containing keys and values.…
Python get value from dict: The Python get() method from dict returns the value for the given key if the key is present in the dictionary. In the…
Python Dictionary fromkeys(): The fromkeys() method creates a new dictionary with keys from a given sequence and values set to a given value in Python. Method signature The…
Python Dictionary copy(): The copy() method creates a shallow copy of the dictionary in python. Therefore, If we modify or add any data in the copied dictionary, those…
Python Set Intersection_Update(): The intersection_update() method updates the source set to reflect the intersection of multiple sets. Hence, the content of original set is modified. Method signature The…
Python Set isdisjoint: The isdisjoint() method returns true if there are no common elements in both sets. Otherwise, this method returns False. In other words, Set A and…
Python Set issubset:The issubset() method checks whether elements from one set are present in another and returns True or False accordingly. For example, Set A is subset of…
Python Set difference_update(): The difference_update() method updates the set by removing an element common with the other sets. In other words, it keeps the unique element of the…