Yaswanth Varma

Yaswanth Varma

307 Articles Published

Articles by Yaswanth Varma

Page 4 of 31

Anagram Substring Search using Python

Yaswanth Varma
Yaswanth Varma
Updated on 24-Jul-2025 449 Views

An anagram is a rearrangement of the characters of a word or a phrase to generate a new word, using all the original characters exactly once. For example, thing and night are anagrams of each other. An anagram substring search includes two strings (text, pattern); we need to search the given text for any substring that contains the same characters as the pattern, in any order. Scenario Following is an example scenario: Input: str1="cbaebabacd", str2="abc" Output: [0, 6] Explanation: In this case, The substring "cba" at index 0 is an anagram of "abc". The substring "bac" at index 6 is an ...

Read More

Analyzing Census Data in Python

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 861 Views

Census data is the source of information collected by the government to understand the population and its characteristics. It consists of details such as age, gender, education, and housing. This helps the government in understanding the current scenario as well as planning for the future. In this article, we are going to learn how to analyze the census data in Python. Python, with its libraries like pandas, numpy, and matplotlib, is widely used for analyzing census data. Analyzing Census Data Here, we are going to use the sample data that consists of the census data stored in ...

Read More

Analysing Mobile Data Speeds from TRAI with Pandas in Python

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 258 Views

The Telecom Regulatory Authority of India (TRAI) publishes the data regarding mobile internet speeds for various telecom operations across India. It 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 downloaded the CSV file named demo.csv with the following structure to use in the examples. demo.csv file ...

Read More

Analyze and Visualize Earthquake Data in Python with Matplotlib

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 914 Views

Earthquakes are natural phenomena that can have effects on human life and infrastructure. With the availability of geospatial and seismic datasets, scientists and researchers can analyze and visualize the earthquake data to identify the patterns, trends, and risk zones. Python, along with libraries like Matplotlib, Pandas, and NumPy, provides the tools to process and visualize the data. In this article, we are going to analyse and visualize earthquake data in Python with Matplotlib. Analyzing and visualizing Earthquake For the examples in this article, we use the dataset named "demo_1.csv" that contains information about the earthquakes. The data ...

Read More

Anagram checking in Python program using collections.Counter()

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 398 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. For example, Scenario Input: str1= "listen", str2= "silent" Output: True Two strings are said ...

Read More

Alternate element summation in list (Python)

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 978 Views

The given task is to perform an alternate summation on a Python List. For example, adding the elements at even indices (0, 2, 4) or odd indices (1, 3, 5), depending on the requirement. This means we need to add every other element from the given list. Let us see an input scenario - Scenario Input: [11, 22, 33, 44, 55] Output: 99 Explanation: Here, we are going to add the elements at the even indices by using the slicing [::2]. Alternate Element Summation Using sum() Function The alternate element summation in a list (Python) can ...

Read More

Alternate range slicing in list (Python)

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 966 Views

Slicing is used to extract a portion of a sequence (such as a list, a tuple, string) or other iterable objects. Python provides a flexible way to perform slicing using the following syntax. list[start:stop:step] Alternate Range Slicing The alternate range slicing is used to retrieve the elements from a list by skipping the elements at a fixed interval, using the step parameter. For example, if we want every second element from a list, we set step=2. Let’s observe some examples to understand how alternate range slicing works. Example 1 Consider the following ...

Read More

Alternate Cycling in Python List

Yaswanth Varma
Yaswanth Varma
Updated on 14-Jul-2025 493 Views

Lists in Python are ordered collections that store and manipulate a sequence of elements. In this article, we are going to learn alternate cycling in Python. It is used when we need to work with the alternate element, instead of processing every element in the list.Alternate cycling is the process of accessing or iterating through list elements by skipping elements in a fixed pattern.  Following is an example scenario - Scenario Input:[1, 2, 3, 4, 6] Output:[1, 3, 5] Explanation: In this case, the alternate cycling starts from the index 0 and skips the next ...

Read More

Concatenated string with uncommon characters in Python?

Yaswanth Varma
Yaswanth Varma
Updated on 20-Jun-2025 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 python set.symmetric_difference() method is used to return the new set that contains the elements that are in either of the sets, but ...

Read More

Python program to iterate over multiple lists simultaneously?

Yaswanth Varma
Yaswanth Varma
Updated on 20-Jun-2025 414 Views

In this article, we are going to learn how to iterate over multiple lists simultaneously. It is useful when the lists contain related data. For example, one list stores names, another stores genders, and the last one stores ages. By iterating over these lists simultaneously, we can access the necessary details of a single person. Iterating Over Multiple Lists using zip() Function The Python zip() function is a built-in function used to combine the elements from two or more iterator objects (such as lists, tuples, etc) and returns the result. The resultant iterator object contains tuples where the ith tuple ...

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