My Blog
Articles related to programming, computer science, technology and research.

Inheritance and Polymorphism in Python

19/04/2018 Categories: Python Programming. No Comments on Inheritance and Polymorphism in Python

Inheritance   Creating a new class from existing class is known as inheritance. The class from which features are inherited is known as base class and the class into which features are derived into is called derived class.   Inheritance promotes reusability of code by reusing already existing classes. Inheritance is used to implement is-a […]

Read the rest of this entry »

Object Oriented Programming in Python

19/04/2018 Categories: Python Programming. No Comments on Object Oriented Programming in Python

Introduction to Classes and Objects   Classes and objects are the two basic concepts in object oriented programming. An object is an instance of a class. A class creates a new type and provides a blueprint or a template using for creating objects. In Python we already know that everything is an object of some […]

Read the rest of this entry »

Packages in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Packages in Python Programming

Introduction   A package is a directory structure which can contain modules and sub packages. Every package in Python is a directory which must contain a special file called __init.py__. The file __init.py__ can be empty. To allow only certain modules to be imported, we can use the __all__ variable in __init.py__ file as follows: […]

Read the rest of this entry »

Functions in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Functions in Python Programming

Introduction to Functions   A function is a block of organized and reusable program code that performs a specific, single, and well-defined task. A function provides an interface for communication in terms of how information is transferred to it and how results are generated.   Need for Functions   Simplifies program development by making it […]

Read the rest of this entry »

Comprehensions in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Comprehensions in Python Programming

Introduction   Python comprehensions are constructs that create sequences from existing sequences in a clear and concise manner. Comprehensions are of three types:   list comprehensions set comprehensions dict comprehensions   List comprehensions were introduced in Python 2.0; while set and dict comprehensions have been introduced in Python 2.7.   List Comprehensions   List comprehension […]

Read the rest of this entry »

Data Structures in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Data Structures in Python Programming

Introduction   A data structure is a construct to store data and organize that data efficiently to perform computations. In Python, data structures can be created using the following types:   Lists Tuples Sets Dictionaries   Lists   List is an ordered collection of objects. Lists are mutable. Individual elements in a list are accessed […]

Read the rest of this entry »

Control Statements in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Control Statements in Python Programming

Introduction   Generally, a Python script executes in a sequential manner. If a set of statements should be skipped or repeated again, we should alter the flow of control. The statements which allow us to alter the flow of control are known a control statements. Python supports the following control statements:   if if..else elif […]

Read the rest of this entry »

Expression Evaluation in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Expression Evaluation in Python Programming

Introduction to Expression Evaluation   A Python program contains one or more statements. A statement contains zero or more expressions. Python executes a statement by evaluating its expressions to values one by one. Python evaluates an expression by evaluating the sub-expressions and substituting their values.   Literal Expressions   A literal expression evaluates to the […]

Read the rest of this entry »

Operators in Python Programming

19/04/2018 Categories: Python Programming. No Comments on Operators in Python Programming

Following are different types of operators in Python:   Arithmetic operators Relational operators Assignment operators Logical operators Bitwise operators Membership operators Identity operators   Arithmetic Operators   Following are various arithmetic operators available in Python:   Operator Description Example + Add two operands x+y = 26 – Subtract one operand from another x-y = 14 […]

Read the rest of this entry »
Scroll Up