Hafeezul Kareem has Published 344 Articles

Python - Joining unicode list elements

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:47:39

270 Views

In this article, we are going to learn how to join Unicode list elements. Follow the below steps to write the code.Initialize the list.Convert all the elements into Unicode using map and string.encode methods.Convert each encoded string using the decode method.Join the strings using join method.Print the result.Example Live Demo# initializing ... Read More

Python - Largest number possible from list of given numbers

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:43:27

1K+ Views

In this article, we are going to learn how to find the possible largest number from the given list of numbers. We will see two different ways to find to solve the problem. Follow the below steps to solve the problem.Import the itertools module for permutations method.Initialize the list with ... Read More

Last occurrence of some element in a list in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:34:57

10K+ Views

In this article, we are going to see different ways to find the last occurrence of an element in a list.Let's see how to find the last occurrence of an element by reversing the given list. Follow the below steps to write the code.Initialize the list.Reverse the list using reverse ... Read More

ldexp() function in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:27:42

148 Views

In this article, we are going see how to use ldexp() function. This is one of the methods from the math library.The function ldexp(first, second) take two valid number either positive or negative and returns the result of first * (2 ** second). Let's see some examples.Example Live Demo# importing the ... Read More

Linear search on list or tuples in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:21:40

3K+ Views

In this article, we are going to learn how to apply a linear search on lists and tuples.A linear search starts searching from the first element and goes till the end of the list or tuple. It stops checking whenever it finds the required element.Linear Search - Lists & TuplesFollow ... Read More

List consisting of all the alternate elements in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:16:46

2K+ Views

In this article, we are going to learn how to get alternate elements from the list. We'll see two different ways to solve the problem.Follow the below steps to solve the problem in one way.Initialize the list.3Iterate over the list and store all the elements from the odd index.Print the ... Read More

List expansion by K in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:08:03

131 Views

In this article, we are going to learn how to expand the list by replicating the element K times. We'll two different ways to solve the problem.Follow the below steps to solve the problem.Initialize the list, K, and an empty list.3Iterate over the list and add current element K times ... Read More

Python - List Initialization with alternate 0s and 1s

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 17:47:10

774 Views

In this article, we are going to learn how to initialize a list with alternate 0s and 1s. We'll have list length and need to initialize with alternate 0s and 1s.Follow the below steps to initialize a list with alternate 0s and 1s.Initialize an empty list and length.Iterate length times ... Read More

List of tuples to dictionary conversion in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 17:36:46

11K+ Views

In this article, we are going to learn how to convert the list of tuples into a dictionary. Converting a list of tuples into a dictionary is a straightforward thing.Follow the below steps to complete the code.Initialize the list with tuples.Use the dict to convert given list of tuples into ... Read More

Python - Make pair from two list such that elements are not same in pairs

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 17:27:24

5K+ Views

In this article, we are going to learn how to make pairs from two lists such that no similar elements make a pair. Follow the below steps to solve the problem.Initialize the lists with elements.Iterate over the lists and append the pair into a list if the corresponding elements from ... Read More

Advertisements