Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python choose random element from list

import random

#1.A single element
random.choice(list)

#2.Multiple elements with replacement
random.choices(list, k = 4)

#3.Multiple elements without replacement
random.sample(list, 4)
 
PREVIOUS NEXT
Tagged: #python #choose #random #element #list
ADD COMMENT
Topic
Name
2+6 =