Random list | Sololearn: Learn to code for FREE!


Random list

Help change random selectes list list = [1,2,3] listr1 = random.choice(list) #changing selected list item code goes here

4/4/2020 12:31:49 PM


2 Answers

New Answer


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] =....


John Robotane Thanks