Blog

python tutorials and learn python

Created with Sketch.

Python program to check if the given number is a Disarium Number

Python program to check if the given number is a Disarium Number A number is said to be the Disarium number when the sum of its digit raised to the power of their respective positions becomes equal to the number itself. For example, 175 is a Disarium number as follows: 11+ 72 + 53 =…
Read more

 Python program to sort the elements of an array in descending order

 Python program to sort the elements of an array in descending order In this program, we need to sort the given array in descending order such that elements will be arranged from largest to smallest. This can be achieved through two loops. The outer loop will select an element, and inner loop allows us to…
Read more

 Python program to sort the elements of an array in ascending order

 Python program to sort the elements of an array in ascending order In this program, we need to sort the given array in ascending order such that elements will be arranged from smallest to largest. This can be achieved through two loops. The outer loop will select an element, and inner loop allows us to…
Read more

 Python program to right rotate the elements of an array

 Python program to right rotate the elements of an array In this program, we need to rotate the elements of array towards its right by the specified number of times. An array is said to be right rotated if all elements of the array are moved to its right by one position. One approach is…
Read more

Python program to print the sum of all elements in an array

Python program to print the sum of all elements in an array In this program, we need to calculate the sum of all the elements of an array. This can be solved by looping through the array and add the value of the element in each iteration to variable sum.   Sum of all elements…
Read more

Python program to print the number of elements present in an array

Python program to print the number of elements present in an array In this program, we need to count and print the number of elements present in the array. Some elements present in the array can be found by calculating the length of the array.   Length of above array is 5. Hence, the number…
Read more

Python program to print the smallest element in an array

Python program to print the smallest element in an array In this program, we need to find out the smallest element present in the array. This can be achieved by maintaining a variable min which initially will hold the value of the first element. Loop through the array by comparing the value of min with…
Read more

Python program to print the largest element in an array

Python program to print the largest element in an array In this program, we need to find out the largest element present in the array and display it. This can be accomplished by looping through the array from start to end by comparing max with all the elements of an array. If any of element…
Read more

Python program to print the elements of an array present on odd position

Python Program: Print Elements at Odd Positions in an Array In this blog post, we will explore a Python program designed to print the elements of an array that are present at odd positions. The article will provide a comprehensive explanation of the algorithm used in the program, present the Python code for implementation, and…
Read more

Python program to print the elements of an array present on even position

Python Program: Print Elements at Even Positions in an Array In this blog post, we will delve into a Python program designed to print the elements of an array present at even positions. The article will walk through the algorithm used in the program, provide the Python code for implementation, and include examples with corresponding…
Read more