coderz.py

Keep Coding Keep Cheering!

Python Exception Handling – I

What is Python Exception Handling? Exception handling is a Python concept used to handle exceptions and errors during program execution. Exceptions can be unexpected, or a developer may anticipate some disruption in the code flow due to an exception that may occur in a specific scenario. In either case, it must be addressed. Try and […]

December 21, 2022 | python | No comments

Errors and Built-in Exceptions

A minor typing error can result in an error in any programming language as we must follow the syntax rules when coding in any programming language. Python Errors: We can make mistakes when writing a program that causes errors when we run it. When a Python program encounters an unhandled error, it crashes. An exception […]

December 19, 2022 | python | No comments

Operator Overloading in Python

Operator overloading refers to providing meaning that extends beyond their predefined operational meaning. For example, the operator + can be used to add two integers, join two strings, or merge two lists. It is possible because the ‘+’ operator is overloaded by the int and str classes. Therefore, the different behavior of a single operator […]

December 18, 2022 | python | No comments

Static Keyword in Python

Class or Static Variables: In Python, a variable declared within a class but outside any method is referred to as a class or static variable. A class or static variable can be referred to, but not directly through an instance. Class or static variables are distinct from and do not conflict with other member variables […]

December 17, 2022 | python | No comments

Polymorphism in Python

What is Polymorphism? Polymorphism is derived from the Greek words poly (many) and morphism (change) (forms). That is, the same function name can be used for multiple types. This makes programming more intuitive and straightforward. Polymorphism can be defined in a variety of ways in Python. So, let’s start and look at how polymorphism works […]

December 16, 2022 | python | No comments

Method Overriding in Python

Method overriding is a feature of any object-oriented programming language that allows a subclass or child class to implement a method that is already provided by one of its super-classes or parent classes. When a method in a subclass has the same name, parameters or signature, and return type (or sub-type) as a method in […]

December 15, 2022 | python | No comments

Access Modifiers in Python

When implementing the concepts of inheritance in Python code, access specifiers or access modifiers are used to restrict the access of class variables and methods outside the class. The three access modifiers most programming languages use are Public, Protected, and Private in a class. The access control for a particular data member or member function […]

December 13, 2022 | python | No comments

Types of Inheritance in Python

Types of Inheritance depend upon the number of child and parent classes involved. There are four types of inheritance in Python: Single Inheritance Multiple Inheritance Multilevel Inheritance Hierarchical Inheritance Single Inheritance: Single inheritance allows for the inheritance of properties from a single parent class by a derived class, allowing for the reuse of existing code […]

December 12, 2022 | python | No comments

Inheritance in Python

Inheritance is a fundamental idea in object-oriented programming (OOP) languages. By deriving a class from another class, you can use this mechanism to build a hierarchy of classes that share a set of properties and methods. Benefits of inheritance include: It accurately depicts real-world relationships. It offers a code’s reusability. We don’t need to keep […]

December 12, 2022 | python | No comments

Destructors in Python

When an object is destroyed, the destructors are called. Destructors are not as necessary in Python as they are in C++ because Python has a garbage collector that manages memory automatically. The _del_() method in Python is known as a destructor method. When an object is garbage collected, or when all references to the object […]

December 12, 2022 | python | No comments

Advertisement