''' Purpose: range looping ''' # get adage s = input( "Enter adage: " ) # get number of occurrences to be printed n = input( "Enter number of lines to be printed: " ) n = int( n ) # change the string handed back from input() to an integer so we can work with it print() # print the n occurrences of the string of interest # we can't loop through a list or a string for this one, so we need a new kind of loop # we want to repeat something n times # new function just dropped: range( a,b ) hands back a sequence: a,a+1,a+2,...,b-2,b-1 # GOTCHA: range() is (inclusive,exclusive), the sequence will not have the last value, it goes up to b-1 # x = range( 0, 10 ) # ranges are special sequences and are very useful for looping a set number of times # print( "x", x ) x just looks like range(0, 10) # for ... in range( 0,n ) will run n times, where our loop variable takes on a new number every time, one # higher than the previous number for current_number in range( 0, n ) : print( s ) # sometimes you don't use the loop variable in the loop, this time it's just a counting loop