“Random.Choice” Kode Jawaban

Pilih Python acak

import random

#sampling with replacement
list = [20, 30, 40, 50 ,60, 70, 80]
sampling = random.choices(list, k=4)
print("Randomly selected multiple choices using random.choices() ", sampling)
Rocku0

Random.Choice

random.choice(sequence)
Clumsy Cockroach

Random.Choice

np.random.choice(5, 3, replace=False, p=[0.1, 0, 0.3, 0.6, 0])
array([2, 3, 0]) # random
Easy Echidna

Jawaban yang mirip dengan “Random.Choice”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya