CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

Python

Python – Modules – A quick walkthrough

When we write a Python program and save that program into a file, that file we can call it as a Module. A module in Python is nothing but a group of statements and definitions, saved into a file. Each module has a purpose. Each module contains group of definitions or functions and statements, exported […]

Understanding Constructors and Destructors in Python

In Python, constructors and destructors are special methods used to initialize and clean up objects of a class. Constructor: __init__ Method The constructor in Python is defined using the __init__ method. It is automatically called when a new object of the class is created. For example, # Vehicle.py class Vehicle: def __init__(self, type, color): self.type […]

Python – Customize Truth Value testing

We have discussed Truth Value testing in our previous Articles “Python – Truth Value Testing” and “Python – Truth Value Testing for Class objects“. Through this article, we will discuss customizing Truth Value testing. We can customize Truth value testing by defining __bool__ and __len__ functions. Initially, Python verifies the definition of _bool_ function; if […]

Python – Truth Value Testing for Class objects

We have discussed Truth Value Testing in our previous Article, “Python – Truth Value Testing“; where we have discussed that Class objects are, by default considered True for Truth Value Testing. Through this article, we will discuss the Truth Value Testing for Class objects. Truth Value Testing for Class objects By default, Truth Value Testing […]

Python – Access Modifiers – Private Name Mangling

There are NO Access Modifiers in Python. Yes, what you READ is CORRECT. Python doesn’t have any Access Specifiers defined. All the defined members can access from anywhere in the program, within the defined scope. Some of the Programming Languages (C++, Java, C# etc,.) provides private, protected & public access modifiers to define the access […]

Python – Control Flows – The while Statement

We have discussed if Statement in our previous Article “Python – Control Flows – The if Statement“. The if Statement is one of the control statements in Python, used to control the flow of the Program depending on the conditional expression. The code is written inside the if Statement is going to execute only once […]

Python – Control Flows – The if Statement

When we write the code in any language, we always write portion of the code to execute depending on certain condition(s). This will give more control and easy to manage the code. The statement which control the flow of the execution is control or conditional statement. One of such control statement is; the if statement. […]

Python – Exception handling

Python provides an exception handling mechanism to handle the Exceptions when something went wrong in the Program. Python interpreter reads the code and throws an Exception when something went wrong; if the mechanism is provided to handle the Error, the Program execution continues, otherwise, the Program terminates. A very good example of an Exception is […]

Scroll to top