Online real estate marketplace and information site RealtyTrac combined together school testing data from state
RealtyTrac defined "good schools" as being schools whose average test scores were at least 33% higher than their overall state average, and measured housing affordability as the percentage of an average wage needed to make payments on a median price home with a standard mortgage.
Here are the most affordable zip codes with at least one good school in the 26 states for which RealtyTrac had data:
And here are the least affordable good-schools zip codes in the 26 states for which that data was available: