Inserting while itterating

Thomas Guettler guettli at thomas-guettler.de
Wed Jan 14 03:43:01 EST 2004


Hi,

Simple excerise:

You have a sorted list of integers:
l=[1, 2, 4, 7, 8, 12]

and you should fill all gaps:

result == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

How would you code this?

Constrain: The original list should be changed,
don't create a copy.

  thomas




More information about the Python-list mailing list