Day 7: Hangman
Last updated
Was this helpful?
Last updated
Was this helpful?
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