I hate to sound so crass but you're either cut out for it or you're not... People get shoved into STEM/tech/whatever because it has good career prospects without ever considering the nuance of what makes children/people successful in this.
Frankly, most people won't even wrap their head around simple conditional logic/algebra. I say "won't" because in my experience they're fully capable, they just put in minimal effort to get past the exercises. I end up having to pace my entire instruction to those kids when I find them in my groups. It's worth noting that I'm in the US where this is sorta an unspoken social contract for getting through school: keep your head down and show minimal effort + don't make waves and you'll be passed right along without a problem (usually with good grades). Thankfully, I'm doing after-school program stuff and the kids want to be there; but, you'd be surprised at how many kids are there because their parents are forcibly bolstering college apps with extra-curriculars (gross).
Sorry to wander a bit there... My main point is that regardless of whatever ideals we would like to hold not everyone is cut out for highly technical work, especially coding. Hopefully I don't come off as too much of a curmudgeon!