+ 2
random
please helo me. how to use random with a list give an example
2 Respuestas
+ 1
let your list be:-
lst=[1,2,3,4]
using random function,
rand_item=random.choice(lst) #assigning the random value to the variable 'rand_item'
0
what he said is correct^
use random.choice('name_of_your_list)