How to iterate on a changing dictionary

Florencio Cano florencio.cano at gmail.com
Mon Jun 20 10:30:52 EDT 2011


> To make an example: imaging Bingo.Shuffle the numbers, each number sorted
> should be removed from the container, how would it implemented?

The structure seems a set -> unordered collection of unique elements.

You can select a random element from the set with
random.sample(container, num_of_elems)

And then remove the elem from the set with remove.



More information about the Python-list mailing list