Learning strategies for isolating issues in non-trivial programs is essential for successful programming of any level. Unlike syntax or run-time errors which can often be looked up online or in a book, a program which is simply not doing what you want often leaves little evidence of what went wrong and where. Though it can be common at first to feel as if identifying these issues requires a stroke of genius or luck, solving them is a teachable skill just like Python syntax or anything else.
One essential habit for helping this problem is learning how to break a problem, and a program, in to smaller chunks. This aids in verifying each bit of code is doing what you intend, and makes fixing the issue easier as well because you don't have to worry as much about affecting something later in the code. For example, writing several Python functions which print the work they've done at their end will make it very clear what didn't go as planned. It also is a great habit for developing a strategy before you code, and for quantitative reasoning in general. Learning how to do this properly can be tricky at first, and may feel very awkward, but it will save time in the long run and will probably become the way you attack all sorts of problems in the future.