In this article, we will show you, How to Write a Python Program to find Sum of Arithmetic Progression Series (A.P. Series) with practical example.

## Python A.P. Series

Arithmetic Series is a sequence of terms in which next item is obtained by adding common difference to previous item. Or

A.P. series is a series of numbers in which difference of any two consecutive numbers is always same. This difference is called as common difference.

In Mathematical behind calculating Arithmetic Progression Series

Sum of A.P. Series : Sn = n/2(2a + (n – 1) d)

Tn term of A.P. Series: Tn = a + (n – 1) d

## Python Program to find Sum of Arithmetic Progression Series Example

This Python program allows the user to enter first value, total number of items in a series, and the common difference. Next, it will find the sum of Arithmetic Progression Series.

# Python Program to find Sum of Arithmetic Progression Series a = int(input("Please Enter First Number of an A.P Series: : ")) n = int(input("Please Enter the Total Numbers in this A.P Series: : ")) d = int(input("Please Enter the Common Difference : ")) total = (n * (2 * a + (n - 1) * d)) / 2 tn = a + (n - 1) * d print("\nThe Sum of Arithmetic Progression Series = " , total) print("The tn Term of Arithmetic Progression Series = " , tn)

**OUTPUT**

## Python Program to find Sum of Arithmetic Progression Series Example 2

This program is same as above. Here, we used While Loop to display the A.P series, which is optional.

# Python Program to find Sum of Arithmetic Progression Series a = int(input("Please Enter First Number of an A.P Series: : ")) n = int(input("Please Enter the Total Numbers in this A.P Series: : ")) d = int(input("Please Enter the Common Difference : ")) total = (n * (2 * a + (n - 1) * d)) / 2 tn = a + (n - 1) * d i = a print("\nThe tn Term of Arithmetic Progression Series = " , tn) print("The Sum of Arithmetic Progression Series : ") while(i <= tn): if(i != tn): print("%d + " %i, end = " ") else: print("%d = %d" %(i, total)) i = i + d

**OUTPUT**

## Python Program to find Sum of Arithmetic Progression Series without Math Formula

In this Program, we are not using any Mathematical formula.

# Python Program to find Sum of Arithmetic Progression Series a = int(input("Please Enter First Number of an A.P Series: : ")) n = int(input("Please Enter the Total Numbers in this A.P Series: : ")) d = int(input("Please Enter the Common Difference : ")) total = 0 value = a print("Arithmetic Progression Series : ", end = " ") for i in range(n): print("%d + " %value, end = " ") total = total + value value = value + d print("\nThe Sum of Arithmetic Progression Series upto %d = %d " %(n, total))

**OUTPUT**

## Python Program to find Sum of Arithmetic Progression Series using Functions

This is same as first example. However, we separated the logic using Functions.

# Python Program to find Sum of Arithmetic Progression Series def sumofAP(a, n, d): total = (n * (2 * a + (n - 1) * d)) / 2 return total a = int(input("Please Enter First Number of an A.P Series: : ")) n = int(input("Please Enter the Total Numbers in this A.P Series: : ")) d = int(input("Please Enter the Common Difference : ")) total = sumofAP(a, n, d) print("\nThe Sum of Arithmetic Progression Series = " , total)

**OUTPUT**