Python List
- 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-676862018aea3223214523/] 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-676862018b1ec179735662/] Now you want to sort list of tuples based on age and age is 1st index in tuple. You […]
- 08 December
Python Convert list to set
In this tutorial, we will see how to convert list to set. You can use python set() function to convert list to set.It is simplest way to convert list to set. As Set does not allow duplicates, when you convert list to set, all duplicates will be removed in the set. Let’s understand with the […]
- 08 December
How to create an empty list in python
In this post, we will see how to create an empty list in python. There are two ways to create an empty list in Python. Using [ ] Using list() function. Let’s see this with the help of example. [crayon-676862018b370712913544/] Output: List 1: [1, 2] List 2: [1, 2] Which is faster: [ ] or […]
- 08 December
convert set to list Python
In this tutorial, we will see how to convert set to list in python. You can use python list() function to convert set to list.It is simplest way to convert set to list. Let’s understand with the help of example. [crayon-676862018c025273277358/] Output: set of Fruits: {‘Apple’, ‘Banana’, ‘Orange’} listOfFruits: [‘Apple’, ‘Banana’, ‘Orange’] set of scales: […]
- 08 December
Python tuple index()
In this post, we will see about Python tuple’s index method.Python tuple’s index method is used to find index of element in the tuple Python tuple count syntax [crayon-676862018c0f0136329841/] tuple1 is object of the tuple and element is the object which you want to get index. Python tuple count example Python tuple index method is […]
- 08 December
Python tuple count()
In this post, we will see about Python tuple’s count method.Python tuple’s count method is used to count the occurrences of element in the tuple. Python tuple count syntax [crayon-676862018c1aa596302059/] tuple1 is object of the tuple and element is the object which you want to get count. Python tuple count example Let’s understand count method […]
- 07 December
python – check if list is empty
In this post, we will see how to check if list is empty in python. It is very easy to check if list is empty in python. You can use "not" to check if list is empty in Python. Let’s understand with the help of simple example. [crayon-676862018c231145183784/] Output: list1 is not empty list2 is […]