I have question regarding checking a condition and running a random choice afterwards which depends on this check. To make it simple: I have six possible outcomes (e.g. names) and each of them has a specific probability for the following random choice experiment. If the experiment turns out to be 1, I want to print a text or something similar (not important). My question is if there is possibility to integrate the check for the result into the following loop or/and if there is a way find a smoother solution than my first approach:
Name = 'Tom' # (result of another process)
p_tom = 0.32
p_daniel = 0.19
#(and so on…)
employees = ['Tom', 'Daniel', 'Clarke', 'Eric', 'William', 'Max']
for i in employees:
if name in employees and employees == 'Tom':
result = np.random.binomial(1,p_tom)
Thanks in advance. My steps in python are only slightly improving.
Aucun commentaire:
Enregistrer un commentaire