Answers for "randomly select from list in python"

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 "randomly select from list in python"

Python Answers by Framework

Browse Popular Code Answers by Language