Blog

python tutorials and learn python

Created with Sketch.

Python program to swap two elements in a list

Python program to swap two elements in a list Given a list in Python and provided the positions of the elements, write a program to swap the two elements in the list. Examples: Input : List = [23, 65, 19, 90], pos1 = 1, pos2 = 3 Output : [19, 65, 23, 90] Input :…
Read more

Python Program to Split the array and add the first part to the end

Python Program to Split the array and add the first part to the end There is a given an array and split it from a specified position, and move the first part of array add to the end. Examples: Input : arr[] = {12, 10, 5, 6, 52, 36} k = 2 Output : arr[]…
Read more

Python Program for Reversal algorithm for array rotation

Python Program for Reversal algorithm for array rotation Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements.

Python Program for array rotation

Python Program for array rotation Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.

Python Program to find largest element in an array

Python Program to find largest element in an array Given an array, find the largest element in it. Input : arr[] = {10, 20, 4} Output : 20 Input : arr[] = {20, 10, 20, 4, 100} Output : 100 Python3 # Python3 program to find maximum # in arr[] of size n    #…
Read more