Program to print tetrahedral numbers upto Nth term | function to print tetrahedral series up to n ; loop to print series ; Calculate and print ith Tetrahedral number ; Driver code ; function call to print series
def printSeries ( n ) : NEW_LINE INDENT for i in range ( 1 , n + 1 ) : NEW_LINE INDENT num = i * ( i + 1 ) * ( i + 2 ) // 6 NEW_LINE print ( num , end = ' ▁ ' ) NEW_LINE DEDENT DEDENT n = 10 NEW_LINE printSeries ( n ) NEW_LINE