Skip to content

Conversation

Sarahwatkinsdev
Copy link

No description provided.

Comment on lines +11 to +16
while len(hold_letters) < 10:
letter = random.choice(list(letter_pool.keys()))

if letter_pool[letter] > 0:
hold_letters.append(letter)
letter_pool[letter] -= 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we want to make sure that we are making a list of letters we the appropriate weights (if we have "A": 4 then that should correspond to ["A', "A", "A", "A"]. We could do some with an implementation could look something like this:

letters = []
for letter in LETTER_POOL: # this will give us the keys
   letters += letter * LETTER_POOL[letter]

then we could get our 10 like so:

 hold_letters = random.sample(letters, 10)   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants