Python program to find the missing term of any Arithmetic progression

In this tutorial, We will see the Python program to find the missing term of any Arithmetic progression. In this type of problem, An array given by the user that represent the elements of the Arithmetic progression in order and one element is missing from the given progression that we have to find through the Python program. To solve this we have to learn something about Arithmetic progression.

What is Arithmetic progression?

In mathematic, An Arithmetic progression is a sequence of numbers such that the difference between the consecutive term is constant.

Algorithm to solve this problem:-

  1. First of all, we find the length of the given array and stored in variable N.
  2. To find the common difference of the Arithmetic progression, we will find the difference between the last term and the initial term of the array and divided by N.
  3. We will assign a variable(s) as the initial term of the given array.
  4. To check which term is missing, we will run a for loop of range from 1 to N and check for every loop if the difference of loop term and s is not equal to common difference then the missing number is the sum of s and common difference else update the value of variable s by loop element.

Find the missing term of any Arithmetic progression in Python

Here, By using the above algorithm, we will write the Python program. Let us assume the Arithmetic progression given by the user is


Python program:-

for k in range(1,N):
if a[k]-s!=c:



So Guy’s, I hope you find it useful.

You may also read:

Leave a Reply

Your email address will not be published. Required fields are marked *