Hi,
I have not figured out how to do this, but I want to see if I can. In my
little Farkle snippet below, I make a list called table and one called hand.
To make the list called hand, I use a list comprehension to get a di if it
is a 1 or a 5. I know these are not nearly all the combinations, but I'm
sneaking up on it. My request is please don't give me the answer. Please
just give me a hint. How can I remove items from the table as I put them in
hand? I thought I should use the remove method, but I somehow ended up with
an empty hand. Here is the code that works now, but doesn't remove from
table.
import random
lowest = 1
sides = 6
table = [random.randint(lowest, sides) for i in range(sides)]
print (table)
hand =[ di for di in table if di in (1, 5)]
print (hand)
Thanks.
Jim
==========
Jim Homme
Skype: jim.homme
FreeChess: jhomme
Twitter: jimhomme <https://twitter.com/jimhome>
Facebook: jimhomme
Website: jimhomme.com <https://www.jimhomme.com>
List web page is
//www.freelists.org/webpage/pythonvis
To unsubscribe, send email to
pythonvis-request@xxxxxxxxxxxxx with "unsubscribe" in the Subject field.