0
Random list
Help change random selectes list list = [1,2,3] listr1 = random.choice(list) #changing selected list item code goes here
2 Réponses
+ 1
you can get the index of the selected item using list.index(list1).
but you can also get a random index using
rand_id=randrange(len(list))
and change the element with this index
list[rand_id] =....
0
John Robotane Thanks