Day 7: Hangman
How to Break a Complex Problem into a Flow Chart

Picking Random Words and Checking Answers
Step 1


RANDOM.SAMPLE( ) We used the random.sample() list previously when we created our Password Generator. To brush up on this module: random.sample(<list_name/set>, <how_many_to_choose_from_the_list)
RANDOM.CHOICE( ) & RANDOM.CHOICES( ) The main difference between 'sample' and 'choice', is that 'choice' only returns a SINGLE item from a list UNLESS you use the random.choices( ) function. This can return multiple items AND CAN also return REPEATED items OR it CAN REPEAT ELEMENTS


Last updated
Was this helpful?