List operation: Removing an item

Terry Reedy tjreedy at udel.edu
Sun Apr 16 01:37:44 EDT 2006


"Miguel E." <miguest66REMOVE at REMOVEyahoo.com> wrote in message 
news:1243ikb79qbujfc at corp.supernews.com...
> Hi,
>
> I've been (self) studying Python for the past two months and I have had
> no background in OOP whatsoever.
>
> I was able to write an interactive program that randomly selects an item
> from a list. From a Main Menu, the user has the option to add items to
> an empty list, show the list, run the random selector, and of course
> quit the program. The program also complains if a user tries to add an
> item that is already in the list prompting the user to enter another 
> item.

Do you really need the items sorted?  I strongly suspect that a set would 
work better.  Much easier to randomly add, delete, and check membership.

Terry Jan Reedy






More information about the Python-list mailing list