Skip to content

Tag Archives: python-list

List in python is mutable types which means it can be changed after assigning some value. The list is similar to arrays in other programming… Read More
In this article, we will learn how to apply a function to each element of a Python list. Let’s see what exactly is Applying a… Read More
Lists are just like dynamically sized arrays, declared in other languages (vector in C++ and ArrayList in Java). Lists need not be homogeneous always which… Read More
A Python list comprehension consists of brackets containing the expression, which is executed for each element along with the for loop to iterate over each… Read More
In Python, list slicing is a common practice and it is the most used technique for programmers to solve efficient problems. Consider a python list,… Read More
Python Lists have various in-built methods to remove items from the list. Apart from these, we can also use del statement to remove an element… Read More
An exception is something that interrupts the flow of the program. These exceptions stop the process running and sends out an error message. Exceptions can… Read More
There are several methods for finding or counting unique items inside a list in Python. Here we’ll discuss 3 methods. Method 1:  The first method… Read More
In this article, we will discuss how to randomly select n elements from the list in Python. Before moving on to the approaches let’s discuss… Read More
Given a List. The task is to find the sum and average of the list. Average of the list is defined as the sum of… Read More
Our task is to print the element which occurs 3 consecutive times in a Python list. Example : Input : [4, 5, 5, 5, 3,… Read More
Let us see how to count the number of unique values in a Python list. Examples : Input : 10 20 10 30 40 40… Read More
Python’s built-in module in random module is used to work with random data. The random module provides various methods to select elements randomly from a… Read More
Given an integer X and a string str consisting of space-separated texts and numbers placed alternately, the task is to sort the string such that… Read More
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   Input:… Read More

Start Your Coding Journey Now!