Inside the linux terminal:- the $ represents the normal user the # represents the root or admin user To check the hostname we can use the hostname command For E...
In Python, a decorator takes a function and adds some functionality and returns it. Everything in python is an objects. In Python, everything is an object—yes, including classes. Simply said, name...
Nested Function When a function is defined inside another function, then it is called Nested Funciton. The Nested Function can access the variables of the enclosing scope. In Python, these non-ocal...
When builing up an iterator in Python, we have to do a lot of work like implementing a class with __iter__() and __next__() methods in a class, keep track of the internal states, and raise StopIter...
In Python, iterators are object that can be iterated upon. For an object to be an iterator it must have two special methods: __iter__ and __next__. In Python, iterators are used extensively. Whil...
Built-in classes can be used with Python operators. However, the same operator responds differently to several types. For instance, the + operator will combine two lists, concatenate two strings, o...
By using inheritance, we may create classes that inherit all the features of their parent classes and allow us to add new ones. Inheritance in Python Inheritance in python refers to defining a new...
Constructors In Python Class functions that begin with double underscore __ are called special functions as they have special meaning. The __init__() method is of great significance. Every time a ...
Object Oriented Programming Python, a multi-paradigm programming language supports several coding techniques. Making objects is one of the common ways to tackle a programming language. This is know...
Data Structures and Sequences Tuple A tuple is fixed-length, immutable sequence of Python objects. The easiest way to create one is with a comma-separated sequence of values tup = 4,5,6 tup Outp...