# Python Program to Sum a Series: Exploring Fractions and Mathematics

## Write a program to sum the following series: 1/3 + 3/5 + 5/7 + 7/9 + 9 /11 + 11/ 13 + ... + 95 /97 + 97 /99

Welcome to our blog post where we delve into the fascinating world of Python programming and mathematics. In this article, we will explore how to write a Python program to calculate the sum of a series involving fractions. Specifically, we will focus on the series 1/3 + 3/5 + 5/7 + 7/9 + 9/11 + 11/13 + ... + 95/97 + 97/99. So grab your coding hat and let's dive in!

• Understanding the Series
• Designing the Python Program
• Running and Testing the Program

## | Learn Python with " Computer Courses - All in One "

### Understanding the Series:

Before we begin writing our Python program, let's take a moment to understand the series we are dealing with. The given series consists of fractions, where each term is formed by dividing an odd number by the consecutive odd number. The series starts with 1/3, followed by 3/5, 5/7, and so on until we reach 97/99.

### Designing the Python Program

To solve this problem, we can use a for loop to iterate through the series and add up the fractions. Here's the Python code to do this:

sum = 0

for i in range(1, 98, 2):

sum += i/(i+2)

print("Sum of the series is:", sum)

In this code, we first initialize a variable sum to zero. Then we use a for loop to iterate through the series. The range function generates a sequence of odd numbers from 1 to 97 with a step of 2. For each odd number i, we add the fraction i/(i+2) to the sum. Finally, we print the value of sum.

### Running and Testing the Program

The output of this program is:

Sum of the series is: 45.124450303050196

In this blog post, we have explored how to write a Python program to sum a series of fractions. By understanding the logic behind the given series and implementing it in Python, we were able to calculate the sum successfully. Python's simplicity and flexibility make it an excellent choice for solving mathematical problems.

By following the steps outlined in this article, you can now write your own Python program, to sum up similar series or modify the code to suit your specific needs. Keep exploring the world of Python programming and embrace the power it offers to solve mathematical puzzles like this one.

Remember, Python is a versatile language with numerous applications, so keep honing your skills and experimenting with different programs. Happy coding!