''' Purpose: print integers from a user-specified upward interval n ... m ''' # get interval of interest reply = input( "Enter start and end: " ) #'2 7' m, n = reply.split() # ['2','7'] m, n = int( m ), int ( n ) # 2, 7 # print out integers m to n for i in range( m, n + 1 , 2) : print( i ) # If you forget the range, Python says "oh that's just a pair # of two numbers!" and that's probably not what we want. # ranges go from i to j-1 but pairs aren't a range so it's the # actual numbers. (3,5) is still 3 and 5 but range(3,5) is 3,4 # range(i,j) -> values i to j-1 # Write this down! # If we want to include the last value, what do we need to do? Add 1 # to the ending value! # Mathematically it's like [m, n) # It includes the starting value but goes all the way up to # but not including the ending value