Python random.sample() -
from random import random random.sample(list_variable,number)
this code generates
attribute error:built-in function or method object has no attribute sample.
i python beginner. please help.
you importing random
function random
package. need import sample function.
from random import sample sample([1, 20, 3], 2)
or import random
package , explicitly call sample function like
import random random.sample([1, 20, 3], 2)
Comments
Post a Comment