It is a good habit to use xrange for these cases