Sarika Singh has Published 72 Articles

What does double underscore prefix do in Python variables?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:30:59

5K+ Views

When a double underscore is added as prefix to python variables the name mangling process is applied to a specific identifier(__var) In order to avoid naming conflicts with the subclasses, name mangling includes rewriting the attribute name. Example Following is the program to explain the double underscore in Python − ... Read More

Python Program to print unique values from a list

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:24:42

2K+ Views

List is a built-in data structure in python which functions like a dynamically sized array. Lists are created by putting elements in square brackets ‘[element 1, element 2, ….]’. Elements present in list are indexed and the indexing starts from [0]. List has the following properties − List is ... Read More

How to dynamically load a Python class?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:22:09

3K+ Views

A class is a group of items. It is a logical entity with a few unique attributes and methods. For instance, if you have a class for Cricket, it should have an attribute and method like players, tournaments, toss, runs, wickets, matches, etc. Use the keyword ‘class’ to create a ... Read More

How do we handle circular dependency between Python classes?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:18:22

3K+ Views

In this article we are going to discuss how to handle the circular dependency between Python classes. First of all, let us understand what is circular dependency. When two or more modules depend on one another, this is known as a circular dependency. This is because each module is defined ... Read More

How do I make a subclass from a super class in Python?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:14:02

3K+ Views

In this article we are going to discuss how to create subclass from a super class in Python. Before proceeding further let us understand what is a class and a super class. A class is a user-defined template or prototype from which objects are made. Classes offer a way to ... Read More

Explain Python class method chaining

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:10:56

12K+ Views

In OOP languages methods are a piece of code that can perform a specific task to produce a desired output. Methods are created inside classes and are invoked or called by objects of the class. Methods are extremely useful in programming as they provide modularity to code by breaking a ... Read More

Python program to split and join a string?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:08:52

8K+ Views

We'll learn how to split and join a string in Python in this article. Python defines strings as a collection of characters enclosed in one, two, or three quotations. When a string is split, it is divided into smaller strings using a specific delimiter. A set of one or more ... Read More

Python Program to replace a word with asterisks in a sentence

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:07:48

2K+ Views

The use of the symbol * (asterisks) in writing or printing as a reference mark, a sign that some letters or words have been omitted, a way to indicate a possible but unproven linguistic form, or for other arbitrary purposes. In this article we will discuss different ways to replace ... Read More

Python program to Remove and print every third from list until it becomes empty?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:05:38

1K+ Views

In this article, we will learn how to remove and print every third element or item from the list until it becomes empty using Python Program. First we create a list, the index of the starting address is 0 and the position of the first third element is 2 and ... Read More

Python program to multiply all numbers in the list?

Sarika Singh

Sarika Singh

Updated on 23-Nov-2022 08:03:08

20K+ Views

You will understand how to multiply every number in a list in Python in this article using various methods. A list is an ordered collection of values that are enclosed in square brackets. List contains values known as items that can be retrieved by their unique index. We'll create a ... Read More

Advertisements