Why are towns built in valleys and not the hills surrounding them

by modernparts
Delts28

Building on top of hills presents far more challenges so most people will only do it if there is a specific reason to (defence and flood protection being two). Having fresh water nearby is also a great advantage for settlements. Pre mains water you'd want to be in close proximity for all your cooking, drinking, cleaning, irrigation, transport and sewage needs.