Program to cyclically rotate an array by one in Python | List Slicing
Given an array, cyclically rotate the array clockwise by one. In this article, we will see how to cyclically rotate an array by one in Python....
read more
Python List copy() Method
The list Copy() method makes a new shallow copy of a list....
read more
Python program to find the longest word in a sentence
Given a string S consisting of lowercase English alphabets, the task is to print the longest word present in the given string in python....
read more
Python – Group Sublists by another List
Sometimes, while working with lists, we can have a problem in which we need to group all the sublists, separated by elements present in different list. This type of custom grouping is uncommon utility but having solution to these can always be handy. Lets discuss certain way in which this task can be performed. Method #1 : Using loop + generator(yield) This is brute force way in which this task can be performed. In this, we iterate the list and make groups dynamically using yield. We keep track of elements occurred and restart list when we find element in second list....
read more
What Is Difference Between Del, Remove and Pop on Python Lists?
In python del is a keyword and remove(), pop() are in-built methods. The purpose of these three are same but the behavior is different remove() method delete values or object from the list using value and del and pop() deletes values or object from the list using an index....
read more
Python | Check if two lists have at-least one element common
Given two lists a, b. Check if two lists have at least one element common in them....
read more
Filter Python list by Predicate in Python
In this article, we will discuss how to filter a python list by using predicate. Filter function is used to filter the elements in the given list of elements with the help of a predicate. A predicate is a function that always returns True or False by performing some condition operations in a filter method...
read more
Python map() function
map() function returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable (list, tuple etc.)...
read more
Rearrange a string according to the given indices
Given a string S and an array index[], the task is to rearrange the string S by placing every character S[i] to position index[i].Example...
read more
Removing Tuples from a List by First Element Value in Python
Given a list of tuples, we need to delete tuples based on a specific condition related to their first element. In this article, we will explore three different approaches to deleting a tuple from a list of tuples based on the first element in Python....
read more
Python | Merging duplicates to list of list
Sometimes, we need to perform the conventional task of grouping some like elements into a separate list and thus forming a list of lists. This can also help in counting and also get the sorted order of elements. Let’s discuss certain ways in which this can be done....
read more
Print a List in Python Horizontally
Printing a list in Python is a common task, and there are several ways to display the elements horizontally. In this article, we will explore some different simple and commonly used methods to achieve this. Each method will be accompanied by code examples to illustrate their implementation....
read more