338 B
338 B
title, tags, firstSeen, lastUpdated
| title | tags | firstSeen | lastUpdated |
|---|---|---|---|
| sample | list,random,beginner | 2019-08-20T16:02:37+03:00 | 2020-10-28T11:45:34+02:00 |
Returns a random element from a list.
- Use
random.choice()to get a random element fromlst.
from random import choice
def sample(lst):
return choice(lst)
sample([3, 7, 9, 11]) # 9