Skip to content

Instantly share code, notes, and snippets.

@z-------------
Last active August 29, 2015 14:15
Show Gist options
  • Save z-------------/5adfab3a9d05a8f8b2ff to your computer and use it in GitHub Desktop.
Save z-------------/5adfab3a9d05a8f8b2ff to your computer and use it in GitHub Desktop.
def rand_item(my_list):
return(my_list[round(random.random() * (len(my_list) - 1))])
'''
use it like so:
waffles_list = ["waffles", "are", "cool"]
random_word = rand_item(waffles_list)
(don't forget to import random)
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment