**The problem: Leibniz harmonic triangle**

*Write a program that prints the harmonic triangle for the depth n, where n is an input value.*

Inspiration source↓

•leibniz harmonic triangle

In the leibniz function, i am stuck at fractions with the numbers

•

**What i have done**

import fractions import math def nCk(n, k): # combinations n choose k f = math.factorial return int(f(n) / f(k) / f(n - k)) def pascaltr(n): depth = [] for i in range(n): row = [] for j in range(i + 1): row.append(nCk(i, j)) depth.append(row) return depth def leibniz(n): l = len(lists) j=1 for i in range(l): k=len(lists[i])+1 while j==k: lists[i]=fractions.Fraction(1,j*lists[i][j-1]) j+=1 print(lists[i]) print(lists) n = eval(input("Input the depth of Harmonic triangle:")) lists = pascaltr(n) print(pascaltr(n)) leibniz(n)

I know the last function on leibniz function isn't thought well ~~my brain is exploding

Please help