Latest Posts From Safa Mulani

How to Check if a String contains a Substring in Python?

A substring is a sequence of characters within a String. The following are the methods in Python to check if a string contains another string i.e. substring. By using find() method By using in operator By using count() method By using str.index() method By using operator.contains() method Method 1: By using find() method The method […]

Python Set – Things You MUST Know

Python set is an un-ordered and un-indexed collection of elements. Every element is unique. The set contains elements that are un-ordered. No duplicates are allowed. The set itself is mutable i.e. one can add/remove items(elements) from it. Unlike arrays, wherein the elements are stored in order, the order of elements in a set is not […]

Polymorphism in Python

Polymorphism means having vivid or different forms. In the programming world, Polymorphism refers to the ability of the function with the same name to carry different functionality altogether. It creates a structure that can use many forms of objects. This permits functions/arguments to use entities of different types at different times. In object-oriented programming, Polymorphism allows a […]

Operator Overloading in Python

Operator Overloading is the phenomenon of giving alternate/different meaning to an action performed by an operator beyond their predefined operational function. Operator overloading is also called Operator Ad-hoc Polymorphism. Python operators work for built-in classes. But the same operator expresses differently with different types. For example, The + operator will perform arithmetic addition on two numbers, merge two lists […]

Calculator Program in Python

Python programming is a great tool to evaluate and make manipulations. In this article, We will be learning a simple command-line calculator program in Python 3. We’ll be using mathematical operators, Conditional statements, functions and handle user input to make our calculator. Prerequisites The system should have Python 3 installed on the local computer and have a […]

Object-Oriented Programming in Python

Object-oriented programming (OOP) refers to the software design wherein programmers define the data type of a data structure, and the types of functions that can be applied to the data structure. This paradigm provides functionalities and behavior pattern to the structure of data. This paradigm maps and models real-world things together and describes a relationship among […]