I want to repeat a coin flip 500 times, and repeat that experiment 30 times and print the total amount of tails (1) per total run. Just running heads/tails is easy enough, but when I mess around to try to repeat this (first while loop) i get the exact same amount of tails each run, which shouldn't be possible.
While I'm a complete newbie, I can't figure out where I did something wrong here ... thanks!
`import random
i=0
count_1=0
rand_count=0
while rand_count<31:
while i < 501:
y=random.randint(0,1)
if y ==1:
count_1=count_1+1
i=i+1
rand_count=rand_count+1
print(count_1)`
Aucun commentaire:
Enregistrer un commentaire