random with probability python

Solutions on MaxInterview for random with probability python by the best coders in the world

showing results for - "random with probability python"
Emanuele
25 Aug 2017
1import random
2
3data = [1, 2, 3, 4, 5, 6]
4probability = [0.3, 0.3, 0.1, 0.1, 0.1, 0.1]
5 
6random.choices(data, probability)
7