import numpy as np n = 10000 #mynt=1 kron=2 sample_space = np.array ([ 1, 2]) gunstige = 0 for k in range (0, n): kast = np.random.choice(sample_space, 3) if (np.sum(kast) == 5): #sum 5 gir 2-2-1, 2-1-2, 1-2-2 gunstige = gunstige + 1 print('To kron og en mynt oppnaaes med en hyppighet:', f'{gunstige/n :.4f}')