Question: Please fix my code for the following problem: My code is: % probability of heads on odd flip N = input ( ' Enter number
Please fix my code for the following problem:
My code is:
probability of heads on odd flip
N inputEnter number of games'
P inputEnter the probability of heads'
game ; records games in an array
j ; index
win ; Accumulator
for i :N
Coin ; Coin starts at aka tails
while Coin ~keeps looping until coin
r rand;
if r P
Coin ;
else
Coin ;
end
gamej Coin;
end
if modj
win win ; counts winsheads
end
game ;
jj;
end
win N
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
