Inheritance in Python

Inheritance at a glance! In the world of Object-Oriented Programming (OOP), Inheritance refers to the mechanism of the capability of a class to derive or extend the properties from another class in the run. This property enables the derived class to acquire the properties or traits of the base class. Inheritance is considered one of […]

Inheritance in Python Read More »

Python Static Method

Python static method belongs to the Class. They are used to create utility methods for the class. The static method is called from the Class reference. They can’t change the state of the object since they belong to the class. In fact, a static method doesn’t have access to the class attributes. The static method

Python Static Method Read More »

Python Classes and Objects

Python is an Object Oriented Programming(OOP) language. Object Oriented Programming is an essential concept in programming, it allows us to break the programs into reusable components, and implement the concepts like Polymorphism, Encapsulation, Inheritance, and Data Abstraction. The classes and objects are the building block of object-oriented programing. It provides a way to concatenate several

Python Classes and Objects Read More »

Python main function Examples

The idea of Python main function is to execute some code only when the Python script is executed directly. The function should not execute when the same script is imported as a Python module in another program. How to Write a Python main Function? When we run a python program, it executes all the statements

Python main function Examples Read More »

Python ternary Operator Examples

Python doesn’t have a ternary operator. But, it supports writing an if-else statement in such a way that it works as a Python ternary operator. Why Python doesn’t have a special ternary operator? Many programming languages have ternary operators. But, their main purpose is to reduce the code size by removing simple if-else blocks. Python

Python ternary Operator Examples Read More »

Python Array – 13 Examples

Python doesn’t have explicit array data structure. It’s because we can do the same things with the List. The list contains a collection of items and it supports add/update/delete/search operations. That’s why there is not much use of a separate data structure in Python to support arrays. An array contains items of the same type

Python Array – 13 Examples Read More »