Yes, you can. (I am a self-taught coder myself). With the rise of GPT-chats, it has become very convenient to ask them especially programming stuff.
+1 to this. I'm currently self-learning coding to a certain extent myself, and ChatGPT can be very,
very helpful, just have to use it right, it's better to use it to tell you what the code does rather than write an entire batch of code which is often slightly wrong and you have to debug it, kinda hard without understanding. It can also be used to automate writing things which are very simple but which you aren't bothered to write yourself. But yeah, it won't do the thinking for you, you still have to understand why you're doing things this way or that way. But then you can also ask it that, and it's often right :)
And alternatively you can always just google. But I just wanted to say that my own learning would have been much more cumbersome without ChatGPT, so I recommend trying using it as a resource.