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 […]
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 as 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 […]
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 for Statement (for loop)
We have discussed about while Statement in our previous Article “Python – Control Flows – The while Statement“. The while Statement is useful to repeatedly execute the statements as long as the conditional expression evaluates to true. In this article, we are going to discuss another compound statement, the for statement. The for Loop The […]
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 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. Very good example of Exception is Division by Zero […]
Python – Numeric Types – float and complex Classes
In our previous article we have discussed about int Class which deals with Integer numbers. In this Article, I will explain float and complex classes. And these classes deals with floating point numbers and complex numbers respectively. float Class – Deals with Floating point numbers We can create floating point numbers using float() constructor. We […]
Python – Numeric Types – int Class
Numeric Types in Python are used to deal with numeric values. Python provides different classes to deal with numeric data; int, float, complex fractions and decimal are those classes. In this Article, I will explain int class which is used to deal with integers. Let’s look at this class and usage of it in Python. int Class […]