• 22 December

### Python list of lists

In this post, we will see how to create a list of lists in python. It is quite easy to create list of lists in Python. You just need to use list’s append method to create list of lists. Here is simple example to create list of lists in Python. [crayon-6273bf65870b6047265540/] Output: List of Lists: […]

• 21 December

### Combine two lists in Python

In this tutorial, we will see how to combine twolist in python There are multiple ways to combine list in python. Using + operator You can use + operator to combine list in python. Let’s understand with the help of example. [crayon-6273bf65880a3704279966/] Output: Combined List: [1, 2, 3, 4, 5, 6, 7, 8] As you […]

• 21 December

### Python count items in the list

In this tutorial, we will see how to count items inlist in python Count total items in the list You can use len() function to count items in the list. Let’s understand with the help of example. [crayon-6273bf6588b4f778908635/] Output: List: [1, 2, 3, 4] Length of list1: 4 Count occurence of each element in the […]

• 19 December

### Python list to tuple

In this tutorial, we will see how to convert list to tuple. Using tuple function You can use python tuple() function to convert list to tuole.It is simplest way to convert list to tuple. Let’s understand with the help of example. [crayon-6273bf6589728533438775/] Output: List of Fruits [‘Apple’, ‘Orange’, ‘Grapes’, ‘Banana’] Tuple of Fruits: (‘Apple’, ‘Orange’, […]

• 10 October

### Convert string to list python

In this post, we will see how to convert String to list in Python. We can use String’s split function to convert String to list. String’s split function Python String split function signature [crayon-6273bf658a44f542259765/] Parameters sep: A string parameter that will be used as a separator. maxsplit: Number of times split Let’s see some examples. […]

• 08 October

### Remove last element from list python

In this post, we will see how to remove the last element from a list in python. Using list.pop() You can use list.pop() method to remove the last element from the list. [crayon-6273bf658a796499877806/] Output: List Of Countries are: [‘India’, ‘China’, ‘Bhutan’, ‘Nepal’] List Of Countries after removing last element: [‘India’, ‘China’, ‘Bhutan’] Removed country: Nepal […]

• 01 April

### python convert list to string

In this post, we will see how to convert a list to String in Python. You can simply use string’s join method to convert a list to String in Python. String’s join method string’s join method return string in which element of the sequence is joined by separator. [crayon-6273bf658aa17778748012/] Let’s see some examples. Join all […]

• 01 April

### Remove from list Python

In this post, we will see how to remove an element from list in python. You can remove elements from list in 3 ways. Using list object’s remove method Here you need to specify element which you want to remove. If there are multiple occurrences of element, then first occurrence will be removed. Please note […]

• 23 December

### Python sort list of tuples

In this tutorial, we will see about how to sort list of tuples on the basis of various criterion. Let’s understand with the help of example Let’s say you have list of tuples as below: [crayon-6273bf658b93e964451696/] Now you want to sort list of tuples based on age and age is 1st index in tuple. You […]