The Art of Writing Loops in Python