dimanche 2 avril 2023

How can I check the probabilities of printing variables with random and count its frequency?

I would like to check/test the print probabilities of the three variables (separate and taken individually),

for example i would like to take many random draws and count the frequency of each value, or something similar. How can I?

import random

a = "Word A1", "Word A2", "Word A3", "Word A4"

b = "Word B1", "Word B2", "Word B3", "Word B4"

c = "Word C1", "Word C2", "Word C3", "Word C4"


a_random = random.choice(a)
b_random = random.choice(b)
c_random = random.choice(c)

sentence = a_random + ", " + b_random + ", " + c_random

print(sentence)



Aucun commentaire:

Enregistrer un commentaire