''' Purpose: print integers from a user-specified downward interval n ... m ''' # get interval of interest reply = input( "Enter start and end: " ) n, m = reply.split() n, m = int( n ), int ( m ) # print out integers n down to m # range has an optional third argument - by default it's 1 (it counts up) if you don't give it a third argument # range(m,n) goes up by 1 for each value of the range from m to n-1 # range( start, end, incrementer ) # The last value will stop at the thing before the end # If incrementer is -1 # and n and m are 5 1 # It goes 5 4 3 2 because we are incrementing down and go all the way down to but not including 1 # Basically just remember that in a range the second argument (end) is never included no matter # what direction (upwards / downwards incrementing) you go for i in range( n, m, -1 ) : print( i )