Answers for "choose a random element from a list"

23

how to randomly choose from a list python

random.choice(name of list)
Posted by: Guest on December-04-2019
1

Select an element of a list by random

import random 

rand_index = random.randrange(len(list)) 
random_num = list[rand_index] 

random_num = random.choice(list)
Posted by: Guest on January-22-2021

Code answers related to "choose a random element from a list"

Python Answers by Framework

Browse Popular Code Answers by Language