What is ‘assert’ in Python?
assert is a statement in Python that is used to check whether a condition evaluates to True or not. If not, it raises the AssertionError exception. assert [condition] For example, assert…
Posts related to Python programming language. This category contains post which primary talks about the python concepts, examples, tips, and etc.
assert is a statement in Python that is used to check whether a condition evaluates to True or not. If not, it raises the AssertionError exception. assert [condition] For example, assert…
Run the following command in your terminal to see the location where pip is installing the packages: pip show <package_name> If you want to know the location of all installed…
The chmod command stands for "change mode". In Unix and Unix-like operating systems, it is used to change the access permissions of files. In Python, you can easily change the…
Filtering a list means keeping only those items in the list that statisfy a particular condition. For example, filtering [1, 2, 3, 4, 5, 6] for even numbers will result…
Addition of two or more sets combines the items of different sets into a single set object. For example, the addition of {1, 2, 5} and {2, 6, 3} results…
Unpacking a list assigns its items to separate variables. It allows you to store list elements under separate named variables. In Python, you can unpack a list in the following…
Parsing HTML in Python allows easy access to the HTML attributes and tags. For example, find and fetch the element by id or class attribute, name of the tag, etc.…
Addition of two equal-length tuples adds each element from one tuple to the element at the same index in another tuple. For example, the addition of (1, 2, 3, 4)…
Asynchronous programs can run multiple tasks simultaneously without waiting for the result of the time taking tasks. It gives multiple tasks the ability to run in an overlapping manner. In…
The multiplication of two equal size lists multiplies each element from one list by the element at the same index in the other list. For example, the multiplication of [1,…