''' Purpose: introduce nested looping. for a user-supplied n, loop n times, where on the ith iteration the integers from 0 to i are printed out. ''' import time # get n reply = input( 'Enter number: ' ) n = int( reply ) # performed the repeated printing of a number series for i in range( 0, n ) : # print a line of the form i: 0 1 2 ... i print( i , ":", end=" ") for j in range( 0 , i + 1 ): print ( j, end= " " ) # Remember the end="" just puts it all on one line print() # General thing about nested for loops: # For the current i we are on, it will finish # the j loop for that given i, move onto the next # i in the range and continue that cycle until # we reach the end of our i range. # Where can we put the new line character to separate # the i values? # Keep indentation in mind! # We put the print() after we printed out all the j # values for the i we are curerrently on and THEN # print out a line after we are done with that i value. # Right now with this single for loop, we're just # printing out values of i. (The output is just the # left hand numbers in output. # But we also want to have another way to print # out each number counting up to i with each i. # How do we do that?