AI is mostly for experienced programmers that quickly (!) want to do tedious tasks like for example writing a recursive function. For example, recently, I pasted a for loop (removing everything company-specific ofc) to GPT4 and asked it to make it a recursively-called function. I could have done it myself but why - when AI could do the same instantly, without my having to do anything."Show me a recursive function in Python." ... I still think books and manuals are more useful in the long term but at least this usage doesn't leak private information and forces you to understand the answer.
Nevertheless, AI does subtle errors, which only experienced programmers can solve, at least with ease / without excessive Googling. I have experienced these bugs a LOT. This is why it's not really suitable for absolute beginners.