''' Purpose: print integers 0 to n-1 for a user-supplied n. then print out 'Ready or not here I come!' ''' # get n reply = input( 'Enter a number: ' ) n = int( reply ) # print out integers 0 to n-1 # i is an iterator # range hands back first number to the second number - 1 # range( 0, n ) is 0, 1, 2, ..., n-1 # if the first number is bigger than the second number there is nothing to count up to for i in range( 0, n ): # the colon is needed for syntax reasons; tells python that the statement is done print( i, n - i ) # for loop does everything indented print( 'Ready or not here I come!' ) # the un-indentation tells Python that the body of the loop is over #for i in range( 0, n+1 ): # this allows the count to go up to n # print( i) # BELOW WILL ONLY PRINT OUT 0 AND n # REMEMBER TO INCLUDE RANGE!!!! THIS IS IMPORTANT FOR TEST!!!!! #for i in ( 0, n ): # the colon is needed # print( i ) # for loop does everything indented # Why iterate? # If you need to print out unknown values a for loop allows you to repeat actions # that allow flexibility in a program