Skip to content

Instantly share code, notes, and snippets.

@Lvl4Sword
Last active March 20, 2016 08:18
Show Gist options
  • Save Lvl4Sword/ef451c9c2e2fe928c2e3 to your computer and use it in GitHub Desktop.
Save Lvl4Sword/ef451c9c2e2fe928c2e3 to your computer and use it in GitHub Desktop.
Print Random Values In A Dict Key
# like this :-)
# doesn't work for nested lists :-(
import random
my_dict = {'lol': [1, 2, 3, 4], 'wut': [5, 6, 7]}
print(random.choice(sum(my_dict.values(), [])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment