''' Purpose: introduce nested looping. for a user-supplied n, loop n times where on the r-th iteration, the integers from 1 to r are printed out. ''' # nesting = putting for loops inside for loops # get n reply = input( 'Enter number: ' ) n = int( reply ) # performed the repeated printing of a number series for i in range( 1, n + 1 ) : # n is the number of rows # print the numbers from 1 to i print( "row", i, end= ": " ) # "stuff; numbers from 1 to", i ) # i is our current row for j in range( 1, i+1 ) : # j is an index (iterator) value; we need i+1 # because ranges are exclusive for the second term product = i * j # this multiplies the row value i times the column value j print( '(', i, j, product, end=" ) " ) print()