Help me with looping

Please read the pinned thread and edit the post so that the code can be read properly. Indentation is crucial in Python, so otherwise it’s hard to be sure we understand what you’re actually trying and therefore where the problem might be.