Seems like you haven't started looking into why that is.
Start by considering how its behaviour is different from what you want it to do. Perhaps that's even enough to figure out in what way the code should be changed.
If you don't know what it should do every step of the way, then read over the instructions some more.
If you don't know where in the code the misbehaviour is, then start adding prints in the code to inspect what happens as it runs. You can make it print out in english what it does step by step and then check the output for logical issues
If you know what should be different, then you'll need to explain what that something is and what's preventing you from fixing it