''' Purpose: print out on the same line, the numbers 1 to r, for user-specified r ''' # get r reply = input( 'Enter an integer: ' ) r = int( reply ) # print the values in the interval 1 ... r for j in range( 1, r+1 ) : # j is an index (iterator) value; we need r+1 because ranges are exclusive for the second term print( j, end=" " )