---
title: "How to Find Sum of Series in Python"
description: "Sample Python script to calculate the sum of the GP series. Knowing the skills applied to write this script useful for interviews."
url: https://srinimf.com/2021/11/22/how-to-find-sum-of-series-in-python/
date: 2021-11-22
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2021/11/series-sum-script-new.png?fit=1200%2C675&ssl=1
categories: ["Python"]
type: post
lang: en
---

# How to Find Sum of Series in Python

Here’s a Python program that calculates the sum of geometric progression series. For instance, 1+11+111+111 and so on. For loop and Range function, you can use to write a script for this.

*Python series sum*

## Geometric progression

This script will work for the GP series for any numeric number. The generalized input is n+nn+nnn+nnnn+ and so on.

### Python knowledge applies

- The range function decides how man terms sends to for loop
- The for loop process the terms till all the numbers of range function
- The print function displays total all the numbers present in this series.

### Python script to calculate series sum

![Python script to calculate series sum](https://i0.wp.com/srinimf.com/wp-content/uploads/2021/11/python-script.png?resize=548%2C324&ssl=1)

### Output

You can see the sum of all the terms in the output. In our case, I have hard-coded the number of terms as ‘5’. You can further improve this by asking for user input from the terminal. You need to use, for this, the input() function.

![Result of Python script that calculates series sum](https://i0.wp.com/srinimf.com/wp-content/uploads/2021/11/result-series-script.png?resize=607%2C414&ssl=1)

Here, first, you can see displays for all the series terms. Secondly, you can see the total of all the terms. It is a tricky python question. Must know [how to](https://srinimf.com/2023/06/05/how-to-print-sum-of-prime-numbers-in-python/) write this logic before your interviews.

Related Posts

- [Optimizing Python Code: Techniques and Examples](https://srinimf.com/2024/09/15/optimizing-python-code-techniques-and-examples/)DateSeptember 15, 2024
- [Python: A Neat Way to Write Recursive Functions](https://srinimf.com/2023/08/05/how-to-write-recursive-functions-in-python/)DateAugust 5, 2023
- [How to Print Name[String] in Reverse order in Python](https://srinimf.com/2021/11/20/python-program-to-print-name-in-reverse-order/)DateNovember 20, 2021

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2021%2F11%2F22%2Fhow-to-find-sum-of-series-in-python%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2021%2F11%2Fseries-sum-script-new.png%3Ffit%3D1200%252C675%26ssl%3D1&description=How%20to%20Find%20Sum%20of%20Series%20in%20Python)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2021/11/22/how-to-find-sum-of-series-in-python/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2021/11/22/how-to-find-sum-of-series-in-python/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2021/11/22/how-to-find-sum-of-series-in-python/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2021/11/22/how-to-find-sum-of-series-in-python/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20Find%20Sum%20of%20Series%20in%20Python&body=https%3A%2F%2Fsrinimf.com%2F2021%2F11%2F22%2Fhow-to-find-sum-of-series-in-python%2F&share=email)
-

### Like this:

Like Loading…
