Python – Check if two lists are identical

Python – Check if two lists are identical   This article deals with the task of ways to check if two unordered list contains exact similar elements in exact similar position, i.e to check if two lists are exactly equal. This is quite a useful utility and can be used in day-day programming. Method 1… Continue reading Python – Check if two lists are identical

Python – Remove first element of list

Python – Remove first element of list Queue data structure is very well known data structure, lists in Python usually appends the elements to the end of the list. For implementing a queue data structure, it is essential to be able to remove the front element from a list. Let’s discuss the ways of removing… Continue reading Python – Remove first element of list

How to concatenate two lists in Python

Ways to concatenate two lists in Python Let’s see how to concatenate two lists using different methods in Python. This operation is useful when we have numbers of lists of elements which needs to be processed in a similar manner. Method #1 : Using Naive Method In this method, we traverse the second list and… Continue reading How to concatenate two lists in Python

Python – Multiply all numbers in the list (All different ways)

Python – Multiply all numbers in the list   Given a list, print the value obtained after multiplying all numbers in a list. Examples: Input : list1 = [1, 2, 3] Output : 6 Explanation: 1*2*3=6 Input : list1 = [3, 2, 4] Output : 24   Method 1: Traversal Initialize the value of the… Continue reading Python – Multiply all numbers in the list (All different ways)

Python List sort() method

Python List sort() method Python list sort() function can be used to sort a List in ascending, descending, or user-defined order. To Sort the List in Ascending Order Syntax: List_name.sort() This will sort the given list in ascending order. This function can be used to sort a list of integers, floating-point numbers, strings, and others.… Continue reading Python List sort() method

Python – Converting all strings in list to integers

Python – Converting all strings in list to integers Interconversion between data types is facilitated by python libraries quite easily. But the problem of converting the entire list of string to integers is quite common in development domain. Let’s discuss few ways to solve this particular problem. Method #1 : Naive Method This is most… Continue reading Python – Converting all strings in list to integers