Many other intellectual activities also teach you how to think and solve problems, for example, playing chess, or solving logic/math puzzles, or studying music. Going into science and mathematics will definitely teach you how to think and solve problems. Even auto mechanics or learning how to fix your own car will teach you how to think and solve problems. There is nothing unique about coding in this respect.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store