Yaswanth Varma

Yaswanth Varma

307 Articles Published

Articles by Yaswanth Varma

Page 3 of 31

Anagram checking in Python program using collections.Counter()

Yaswanth Varma
Yaswanth Varma
Updated on 25-Mar-2026 422 Views

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once. For example, thing and night are anagrams of each other. In this article, we are going to learn how to check an anagram in a Python program using collections.Counter() method. This method counts the number of occurrences of each element in a collection (like characters in a string), helping us to compare two words for identical character counts ? Understanding the Problem Input: str1= "listen", str2= "silent" Output: True ...

Read More

Analysing Mobile Data Speeds from TRAI with Pandas in Python

Yaswanth Varma
Yaswanth Varma
Updated on 25-Mar-2026 277 Views

The Telecom Regulatory Authority of India (TRAI) publishes data regarding mobile internet speeds for various telecom operators across India. This data is useful for users and telecom companies to evaluate and compare the performance of different service providers. In this article, we are going to use pandas in Python to analyze the TRAI mobile data speed reports. Let's assume we have a CSV file named demo.csv with the following structure to use in the examples. Sample Data Structure ...

Read More

Class or Static Variables in Python?

Yaswanth Varma
Yaswanth Varma
Updated on 25-Mar-2026 7K+ Views

In this article we are going to learn about class or static variables in Python. The class variables or static variables are used to share data across all the instances of a class. Unlike instance variables which are specific to each object, class variables maintain a common value for all objects of the class. They are defined within the class but outside any instance methods, making them accessible to all instances. These variables are used when we want to have a single shared state or value among all instances. Syntax class ClassName: ...

Read More

Python program to print all sublists of a list.

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 6K+ Views

A sublist is a portion of a list containing one or more elements from the original list. Sublists can be contiguous (elements appear in the same order as the original) or non-contiguous (elements are taken from different positions). Printing Contiguous Sublists Using Nested Loops Contiguous sublists maintain the original order of elements. We can generate them using nested loops ? def print_contiguous_sublists(items): for i in range(len(items)): for j in range(i, len(items)): print(items[i:j+1]) ...

Read More

Concatenated string with uncommon characters in Python?

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 1K+ Views

In Python, Strings are one of the commonly used data types that are used to store sequences of characters. In this article, we are going to learn to concatenate strings with uncommon characters in Python. The uncommon characters are the characters that appear in one string but not in the other string. For example, if str1="ABC" and str2="BCD", the uncommon characters are 'A' and 'D', and the concatenated result is "AD". Using set.symmetric_difference() Method The set.symmetric_difference() method returns a new set that contains elements present in either of the sets, but not in both. This makes it ...

Read More

Python program to create 3D list.

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 2K+ Views

In Python, a 3D list is also called a three-dimensional array (list of lists of lists). It can be visualized as a cube or a set of tables stacked together. It is commonly used to represent data with three indices, such as a matrix of images (height, width, depth) or storing data for multiple 2D grids. In this article, we will learn how to create a 3D list. While Python doesn't have built-in support for multi-dimensional arrays like other programming languages, we can create and manipulate 3D lists using nested lists and loops. Using Nested Loops The ...

Read More

Python program to Display Hostname and IP address?

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 2K+ Views

In this article, we are going to learn how to display the hostname and IP address. Generally, the devices that connect to a network are identified by two things: Hostname: It is the name assigned to the device on a network. It helps users to identify devices in a human-readable format (e.g, mypc, desktop-pc, etc.) IP Address: It is the numerical address assigned to each device on a network, used to locate and communicate with that device. Python provides the built-in socket module for achieving this task, which ...

Read More

Python program to reverse bits of a positive integer number?

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 2K+ Views

In Python, every number is represented internally as a sequence of binary digits, known as bits. In this article, we are going to learn how to reverse the bits of a positive integer number using different approaches. What is Bit Reversal? When we reverse bits of an integer value, we flip the order of its binary digits such that the least significant bit becomes the most significant bit and vice versa. Bit Reversal Example Original: 10 1 0 ...

Read More

Python program to print the initials of a name with last name in full?

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 5K+ Views

In this article, we are going to learn how to print the initials of a name with last name in full. For example, in applications like resumes or media references, instead of writing "Sai Vamsi Srinivas", we might write "S.V. Srinivas". This kind of formatting improves readability and ensures the important part of the name (last name) is fully visible. Using Python split() and join() Methods The Python split() method splits all words in a string using a specified separator. The separator can be a space, comma, or any other character. Following is the syntax ? ...

Read More

Python program to split the even and odd elements into two different lists.

Yaswanth Varma
Yaswanth Varma
Updated on 24-Mar-2026 24K+ Views

In this article, we are going to learn about splitting the even and odd elements into two different lists. This involves looping through each element in a list and checking whether it is divisible by 2. Even numbers are those that give the remainder '0' when divided by 2, while the odd numbers leave a remainder '1'. Using append() Method The Python append() method is used to add a new object to a list. It accepts an object as an argument and inserts it at the end of the existing list. Syntax list.append(obj) ...

Read More
Showing 21–30 of 307 articles
« Prev 1 2 3 4 5 31 Next »
Advertisements