Earlier quoted context omitted.
Being a good enough developer to build a career in this field doesn't require a high IQ but it does require a special kind of mindset as you said. I also used to think that everyone could learn to code but I came to realize that this mindset can't be learned. Some people maybe discover that they have this mindset later in life and that's why learn to code is still a useful piece of advice because it'll reach them but…
I teach coding. The mindset absolutely can be learned, but indeed, you need to learn some attitude, not just skills. But a teacher can show how it is done; the exploration, the part when you do not give up when you encounter an error, etc. In my experience, the most significant first barrier is the command line and the environment setup. This is why I always start with explaining the Unix shell and ssh. It gets a lot…
All interested in programing and in pursuing a CS degree and yet some of them wanted only the solution. They were not interested in why their code didn't work or what the error was, they wanted me to jump in and give them the solution.
It's like they liked the idea of being a developer like many like the idea of becoming a writer, but they didn't have that mindset, that stubbornness and willingness to spend hours reading some shitty incomplete readme, going through dozens of GitHub issue threads, googling compiler's errors, reading the doc, trying until it works and feeling that rush of pleasure once it compiles/do whatever you want your program to do.
And some of them couldn't grasp some basic, fundamental concepts like a for loop or accessing a method on an object after two semesters in a CS program.