''' 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. ''' # get n reply = input( 'Enter number: ' ) n = int( reply ) # performed the repeated printing of a number series for r in range( 1, n + 1 ) : # print the numbers from 1 to r for j in range(1, r + 1): print(j, end=' ') print() # prints nothing and moves cursor to next line