### Second Largest number in a List – Python Way

In this code, we will find out the second largest number from a list of integer numbers. There are several ways to do this. The first approach is as follows lst = [34, 56, 56, 56, 45, 2, 4, 12, 45] x=[] for i in lst: if i not in x: x.append(i) lar = max(x) […]

### Python Program to shift Numbers

Python program to shift numbers This python program shifts positive numbers at the left-hand side and negative number at the right-hand side

### Recursive Binary Search Function in Python

The binary search method is based on divide and conquer rules. It is basically applied on the sorted list of array of numbers. The binary search method performs in this way. Compare the number with middle number in the array if the number is equal to our data – it return the position of that […]

### Sum of list Element using Recursion

The sum of list element using recursion is a user-defined function to find out the sum of each element available in any python list.

### List comprehension Problem- with Python Solution

Lets say you have a list stored in a variable a = [ 12,3,45,6,6,45,123,345,67,78,43,23,567,87,9,23,8,4]. You are required to write only one line of python code that is able to generate a new list that contains only even numbers. The simple iterative solution is like this # Program to find and display all the even numbers […]

### Common elements of Two list- Python Code

You are required to take two lists, say for example these two: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] and write a program that returns a list that contains only the elements that are […]