Подключение к беспроводному дисплею через скрипт

Общее решение:

import random
def weighted_choice(choices, weights):
    total = sum(weights)
    treshold = random.uniform(0, total)
    for k, weight in enumerate(weights):
        total -= weight
        if total < treshold:
            return choices[k]
0
задан topherg 13 July 2018 в 11:16
поделиться