Pradeep Elance has Published 417 Articles

Assign range of elements to List in Python

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:10:36

604 Views

Lists are very frequently used data container in Python. While using lists we may come across a situation where the elements of the list maybe a sequence of numbers. We can add this sequence of numbers to a list using many Python functions. In this article we will explore different ... Read More

Assign multiple variables with a Python list values

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:08:51

2K+ Views

Depending on the need of the program we may an requirement of assigning the values in a list to many variables at once. So that they can be further used for calculations in the rest of the part of the program. In this article we will explore various approaches to ... Read More

Append multiple lists at once in Python

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:06:09

8K+ Views

For various data analysis work in python we may be needed to combine many python lists into one list. This will help processing it as a single input list for the other parts of the program that need it. It provides performance gains by reducing number of loops required for ... Read More

Accessing nth element from Python tuples in list

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:03:45

940 Views

A python list can contain tuples as its elements. In this article we will explore how to access every nth element form the tuples that are present as the elements in the given tuple.Using indexWe can design a for loop to access the elements from the list with the in ... Read More

Get positive elements from given list of lists in Python

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:00:46

491 Views

Lists can be nested, means the elements of a list are themselves lists. In this article we will see how to find out only the positive numbers from a list of lists. In the result a new list will contain nested lists containing positive numbers.With for inHere we simply apply ... Read More

Finding frequency in list of tuples in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:22:42

533 Views

Many different types of data container can get mixed up in python. A list can have elements each of which is a tuple. In this article we will take such a list and find the frequency of element in the tuples which are themselves elements of a list.Using count and ... Read More

Find sum of frequency of given elements in the list in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:21:16

497 Views

A given list has many repeated items. We are interested in finding out the sum of the frequency of some such items which are repeated in the list. Below are the approaches how we can achieve this.With sumWe have two lists. One has the list of values and other has ... Read More

Find frequency of given character at every position in list of lists in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:19:58

261 Views

Lets consider a scenario where you have a list which is made of lists as its elements. We are interested in finding the frequency of one character at different positions of the inner lists. Below example will clarify the requirement.Consider a list of lists given below.listA = [['a', 'a', 'b'], ... Read More

Find elements of a list by indices in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:17:19

6K+ Views

Consider two lists. The elements in the second list are numbers which needs to be considered as index position for elements of the first list. For this scenario we have the below python programs.With map and getitemWe can use the getitem magic method is used to access the list items. ... Read More

Extract only characters from given string in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:16:10

3K+ Views

A piece of data may contain letters, numbers as well as special characters. If we are interested in extracting only the letters form this string of data, then we can use various options available in python.With isalphaThe isalpha function will check if the given character is an alphabet or not. ... Read More

Advertisements