Question: for python CS104 - Fall 2021 Final - Page 6 of 7 5. (15 points) Write a Python program that simulates flipping a coin. The

for python
for python CS104 - Fall 2021 Final - Page 6 of 7

CS104 - Fall 2021 Final - Page 6 of 7 5. (15 points) Write a Python program that simulates flipping a coin. The program should have a method called four Tails() that repeatedly flips a coin until the results of the coin toss are four tails in a row. You may use a randint() method from random module to ensure both head and tail have the same probability to appear (if you generate two random numbers, you may consider one to be as tail and another one to be as head). Each time the coin is flipped, program should print out H for heads, or T for tails. When four tails in a row are flipped, the program should terminate. Here is a possible output of the program: TTHTTHHTHTHTTTT Four tails in a row

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!