In this tutorial, we will write an example to print Fractional Sequence with a loop and calculate the sum of the series.

### Source Code

```
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
a = 2.0
b = 1.0
sum = 0
for n in range(1,21):
sum += a / b
t = a
a = a + b
b = t
print('The sum of fractional sequence: %s'%sum)
```

Output:

```
The sum of fractional sequence: 32.66026079864164
```