A coin tossed 6 times & result stored in an array. Write a program to find out the count as Head’s and tail’s as come as results.
Answers
This makes a variety of length N for you to store the outcomes. Presently, your principle blunder is tuned in. You ought to characterize that work outside the circle and call it in every cycle:
Note that I changed the main line to random.randint(0, 1) as it is comprehensive on the two closures. Presently, in the event that you run coin_flip() it will return either "Heads" or "Tails". Change your circle appropriately:
This is the place you are adjusting the epsilon cluster. Note that in every cycle I am calling coin_flip() capacity and allotting it to result.
Presently printing epsilon will give you a cluster as pursues:
array([ 1., 1., 1., - 1., - 1., 1., - 1., - 1., - 1., - 1.])
This is the long method for doing it. Rather, you can do (with arbitrary library). That method is given below.