Insertion sort: the Python, one line at a time

Python


    

The list: items (dark bars are the sorted part · the card below the row is the card in hand · the dashed outline is the gap)

index–
item_to_insert–
position–

Output (print)