Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
cities = Hash.new
cities[:san_fran] = [-122.75,36.8,-121.75,37.8]
cities[:new_york] = [-74,40,-73,41]
cities[:houston] = [-95.7,29.4,-94.7,30.4]
cities[:los_angeles] = [-118.4, 33.7,-117.4,34.7]
cities[:chicago] = [-88.3, 41.5, -87.3, 42.5]
cities[:phoenix] = [-112.3, 33.1, -111.3, 34.1]
cities[:philadelphia] = [-75.5, 39.6, -74.5, 40.6]
cities[:san_antonio] = [-98.8, 29.1, -97.8, 30.1]
cities[:austin] = [-97.9, 30.1, -96.9, 31.1]
cities[:san_diego] = [-117.6, 32.1, -116.6, 33.1]
#cities[:caracas] = [-67.9, 9.5, -66.9, 10.5]
#cities[:cape_town] = [18.3, -34.3, 19.3, -33.3]
#cities[:johan] = [27.5, -26.6, 28.5, -25.6]
#cities[:port_elz] = [25.2, -34.1, 26.2, -33.1]
boxes = Array.new
cities.each_pair do |key,value|
boxes += value if value.size == 4
end
puts "Number of boxes: #{boxes.size/4}"
puts "Boxes: #{boxes.inspect}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment