• Find common elements in two lists Python
    25 May

    Find common elements in two lists in python

    💡 Outline You can first convert first list into set using set() and call intersection() by passing second list as parameter to find common element in two lists in Python. [crayon-673f58050dfe9187341216/] In this tutorial, we will see different methods to find common elements in two lists in python. Using the intersection() Function This is the […]

  • 07 December

    Python List append()

    In this tutorial, we will see about Python List‘s append method.Python List append is used to add single element to end of the list. Let’s understand about basic of python list first. Python List is nothing but the collection of elements. You can add any data type to the list. You can create simple list […]

  • 07 December

    Python List pop()

    In this tutorial, we will see about Python List‘s pop method.Python List pop method is used to remove and return the element at specified index. Python List insert syntax [crayon-673f58050e53e781279204/] here list1 is object of list. Python List pop example You can simply use pop method to remove and return element at given index.If you […]

  • 07 December

    Python List reverse()

    In this tutorial, we will see about Python List‘s reverse method.Python List reverse method is used to reverse the list. Python List reverse example You can simply call reverse method to reverse the list. Let’s understand this with the help of simple example. [crayon-673f58050e642913627507/] Output: listOfItems: [‘Clock’, ‘Bed’, ‘Fan’, ‘Table’] listOfItems in reversed order: [‘Table’, […]

  • 07 December

    Python List remove()

    In this tutorial, we will see about Python List‘s remove method.Python List remove method is used to remove passed element from the list.It will remove first matching element from the list. Python List remove syntax [crayon-673f58050e7a0645006117/] here list1 is object of list. Python List remove example You can simply call remove method to delete an […]

  • 07 December

    Python List sort()

    In this tutorial, we will see about Python List‘s sort method.Python List sort method is used to sort the list either in ascending or descending order. Python List sort syntax [crayon-673f58050e8ac188174020/] here list1 is object of list.As you can see key and reverse are optional parameters. Python List sort example You can simply call remove […]

  • 07 December

    Python List insert()

    In this tutorial, we will see about Python List‘s insert method.Python List insert method is used to insert element to the specified index in the list. Python List insert syntax [crayon-673f58050e990136002337/] here list1 is object of list. list1.insert(1, ‘hello’): This code will add ‘hello’ string to 1st index of list1.Please note that Python index starts […]

  • 07 December

    Python List index()

    In this tutorial, we will see about Python List‘s index method.Python List index method is used to find index of element in the list Python List index example You can simply use index method to find index of the element in the list. If there are multiple occurences of element, then it will return first […]

  • 07 December

    Python List count()

    In this tutorial, we will see about Python List‘s count method.Python List count method is used to count a number of instances of the element in the list. Python List count example You can simply use count method to find number of occurrences of element in the list. Let’s understand this with the help of […]