📜  python 随机选择不替换 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.256000             🧑  作者: Mango

代码示例1
import random

aList = [20, 40, 80, 100, 120]
print ("choosing 3 random items from a list using random.sample() function")
sampled_list = random.sample(aList, 3)
print(sampled_list)