Python program to shift numbers This python program shifts positive numbers at the left-hand side and negative number at the right-hand side
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 […]
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.
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 […]
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 […]
Search a word in text File python way is our attempt to search any word in text file nbot using old fashion way like we do in C/C++. Only 4 line code was able to perform the task.
Suppose a list of number is available to you. you are requested to find out the frequency of these elements available in this list using a dictionary. Dictionary is a data type available in python that can contain unsorted items using keys. The combination of key and value define a dictionary. After the execution of […]