Logo

Programming-Idioms

History of Idiom 11 > diff from v83 to v84

Edit summary for version 84 by gnrfan:
New Python implementation by user [gnrfan]

Version 83

2019-10-14, 12:21:40

Version 84

2019-12-26, 16:42:55

Idiom #11 Pick a random element from a list

List x must be non-empty.

Illustration

Idiom #11 Pick a random element from a list

List x must be non-empty.

Illustration
Extra Keywords
choose
Extra Keywords
choose
Imports
from random import choice
Code
random.choice(_x)