Pradeep Elance has Published 446 Articles

Find keys with duplicate values in dictionary in Python

Pradeep Elance

Pradeep Elance

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

4K+ Views

While dealing with dictionaries, we may come across situation when there are duplicate values in the dictionary while obviously the keys remain unique. In this article we will see how we can achieve thi.Exchanging keys and valuesWe exchange the keys with values of the dictionaries and then keep appending the ... Read More

Find k longest words in given list in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:55:36

139 Views

We have a scenario where we have to pick the top n longest word from a list containing many words of varying length. In this article we will see various approaches to achieve that.With count() and sorted()We first sort the elements of the list in the reverse order so that ... Read More

Find indices with None values in given list in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:51:16

511 Views

Manytime when dealing with data analysis we may come across the None values present in a list. These values can not be used directly in mathematical operations and string operations etc. So we need to find their position and either convert them or use them effectively.With range()Combining the range and ... Read More

Find groups of strictly increasing numbers in a list in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:48:18

226 Views

Sometimes we may need to evaluate if the elements in a list are strictly incremental. Which means the numbers are increasing with a gap of 1. In this article we will see how to find out the groups of strictly increasing numbers in a given list.Direct comparisonIn this approach we ... Read More

Find fibonacci series upto n using lambda in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:43:29

2K+ Views

A fibinacci series is a widley known mathematical series that explains many natural phenomenon. It starts with 0 and 1 and then goes on adding a term to its previous term to get the next term. In this article we will see how to generate a given number of elements ... Read More

Find elements within range in numpy in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:41:23

2K+ Views

Sometime while processing data using the numpy library, we may need to filter out certain numbers in a specific range. This can be achieved by using some in-built methods available in numpy.With and operatorIn this approach we take an numpy array then apply the logical_and function to it. The where ... Read More

Find depth of a dictionary in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:40:38

605 Views

A python dictionary can be nested i.e., there are dictionaries within a dictionary. In this article we will see how to calculated the level of nesting in a dictionary when there is a nested dictionary.With string conversionIn this approach we convert the entire dictionary into a string. Then we count ... Read More

Find common elements in three sorted arrays by dictionary intersection in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:38:40

216 Views

While manipulating data using python we may come across situation where we need to find the elements which are common among the multiple arrays. This can be achieved by converting the arrayd into dictionaries as shown below.In the below example we take the arrays and apply the Counter container from ... Read More

Find all triplets in a list with given sum in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:37:24

1K+ Views

In a list of numbers we want to find out which three elements can join to give a certain sum. We call it a triplet. And in the list there can be many such triplets. For example, the sum 10 can be generated form numbers 1, 6, 3 as well ... Read More

Find all possible substrings after deleting k characters in Python

Pradeep Elance

Pradeep Elance

Updated on 26-Aug-2020 07:33:55

127 Views

we are given a string. The required task is to take out one letter from the string and print the remaining letters in the string. And this we have to so for each letter of the string.With loops and rangeThis is a basic programming approach in which we first list ... Read More

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