text_plain_output_1.png
from itertools import permutations

from scipy.special import binom

import numpy as np # linear algebra

n, m = (4, 2)
def functional(m, n):
    antennas = [0 for i in range(m)] + [1 for i in range(n - m)]
    network = set(permutations(antennas))
    failure = 0
    for i in network:
        for j in range(len(i) - 1):
            if [i[j], i[j + 1]] == [0, 0]:
                failure += 1
                break
    k = len(network)
    return (k - failure) / k

colors = ['clubs', 'diamonds', 'hearts', 'spades']
def draw():
    return list(zip(np.random.choice(range(1, 14), size=5), np.random.choice(colors, size=5)))
d = draw()
d