Could you add a print statement in each iteration?
PS: You can post code snippets by wrapping them into three backticks ``` 
This would make is easier to debug the code, as I’m currently unsure about the indentation of the code.