Nathan Pinno said unto the world upon 2005-08-09 23:31: > Say I deal 5 cards, and then list them. How would I print the list > of cards, with the numbers of each card(the position in the list)? > Then delete a certain card or cards, based upon the user's choice?. > > > Nathan
Nathan, I write this not in the spirit of "I told you so" but to point out what I meant before. If you have your card-dealing function just print out the cards as it picks them, then later on in your program, the information about what cards were picked is not available. If instead, your deal function returns them, binds the return value to a name (as my code of yesterday did), the information is still kicking around in the name to which the returned card selection was bound. If you look at Luke's example, he started it all off with binding the name alist to a sequence which the rest of his code drew on to facilitate the user's choosing things out of. Replace Luke's alist = ["1","2","3","4","5"] with cards_dealt = function_that_returns_a_deal() and you're making progress. With a "prints but does not return" dealing function, you cannot do this. Best, Brian vdB _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor