Pradeep Elance has Published 445 Articles

Check if list contains all unique elements in Python

Pradeep Elance

Pradeep Elance

Updated on 09-Sep-2020 12:19:26

9K+ Views

A list in python can contain elements all of which may or may not be unique. But for a scenario when we need unique elements like marking the attendance for different roll numbers of a class. Below is the approaches with can use.With Set()A python set is a collection which ... Read More

Assign ids to each unique value in a Python list

Pradeep Elance

Pradeep Elance

Updated on 09-Sep-2020 12:14:43

745 Views

While using Python dictionary we may need to identify each element of the dictionary uniquely. For that we have to assign unique IDs to each of the element in the dictionary. In this article we will see how to assign the same unique Id to an element if it is ... Read More

Python to Find number of lists in a tuple

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:11:56

267 Views

A python tuple is ordered and unchangeable. But it can also be made up of lists as its elements. Given a tuple made up of lists, let’s find out how many lists are present in the tuple.with len()In this approach we will apply the len function. The len() function will ... Read More

Find missing numbers in a sorted list range in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:10:09

780 Views

Given a list with sorted numbers, we want to find out which numbers are missing from the given range of numbers.With rangewe can design a for loop to check for the range of numbers and use an if condition with the not in operator to check for the missing elements.Example Live ... Read More

Find missing elements in List in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:08:57

1K+ Views

If we have a list containing numbers, we can check if the numbers are contiguous or not and also find which numbers are missing from a range of numbers considering the highest number as the final value.With range and maxWe can design a for loop to check for absence of ... Read More

Find mismatch item on same index in two list in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:07:12

3K+ Views

Sometimes we may need to compare elements in two python lists in terms of both their value and position or index. In this article we will see how to find out the elements in two lists at the same position which do not match in their value.Using for loopwe can ... Read More

Find Min-Max in heterogeneous list in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:05:29

432 Views

A python list can contain both strings and numbers. We call it a heterogeneous list. In this article we will take such a list and find the minimum and maximum number present in the list.Finding MinimumIn this approach we will take the isinstance function to find only the integers present ... Read More

Find Mean of a List of Numpy Array in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:04:18

661 Views

Numpy is a very powerful python library for numerical data processing. It mostly takes in the data in form of arrays and applies various functions including statistical functions to get the result out of the array. In this article we will see how to get the mean value of a ... Read More

Find Maximum difference pair in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:02:34

353 Views

Data analysis can throw a variety of challenges. In this article we will take a list with numbers as its elements. Then we will find such pairs of elements in the list which has maximum difference in value between them.With nlargestThe approach here is to first find out all possible ... Read More

Find longest consecutive letter and digit substring in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 08:00:29

278 Views

A given string may be a mixture of digits and letters. In this article we are required to find the biggest substring that has letters and digits together.with re moduleThe regular expression module can be used to find all the continuous substring having digits or letters. Then we apply the ... Read More

Previous 1 ... 5 6 7 8 9 ... 45 Next
Advertisements