1 python program. First to submit a functioning program that satisfies the given
ID: 3567906 • Letter: 1
Question
1 python program. First to submit a functioning program that satisfies the given directions gets 5 stars and all points. If that is not achieved, all points and 5 stars go to the most helpful answer.
1.Odd Streak of Heads. Write a program (called q1.py) to compute on average, how many times do you need to flip a fair coin before you have seen an odd number of heads in a run, followed by a tail? Let H and T represent heads and tails, respectively. Examples of valid runs include HT (ending with 1 head and 1 tail), HHTTTTHHHT (ending with 3 heads and 1 tail), TTHHTTHHHHTHHHHHHHT (ending with 7 heads and 1 tail). These are not valid runs: T (no heads and 0 is an even number), H (must end with T), HHT (a run of an even number of heads followed by a tail), etc.
Output:
Number of trials: 10
Total number of tosses: XXXX
Average number of coin tosses: XXXX.XX #Where the XXXX'x are the driven output of the program
Explanation / Answer
http://www.writingcentre.us/ saves your time
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.