Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

random elements in python list

animal = ["monkey","cat","goat","cow","horse","snake","dog"]
randomlst = []
n = len(animal)
for i in random.sample(range(0,n),n):
    randomlst.append(animal[i])
print(randomlst)
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #random #elements #python #list
ADD COMMENT
Topic
Name
7+1 =