1.monte carlo simulation for a consecutive head toss. 2.ssue I am facing is that I get an error like this 3. {Error: unexpected input in "ngtm <−" 4.how do I fix this? and is there any syntax issues in this code?
nreps = 1000
m = 100
k = 10
ngtm <− function( 10, 100, 1000 ) {
count <− 0
for ( rep in 1 : nreps ) {
blank ( a )
for ( i i n 1 : blank ( b ) ) {
toss <− sample ( 0 : 1 , 1 )
if ( toss ) {
consech <− consech + 1
if ( consech == blank ( c ) ) break
} else consech <− 0
}
if ( consech < k ) count <− count + 1
return ( count / blank ( d ) )
}