Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python question in Code step by step https://www.codestepbystep.com/problem/view/python/loops/flip_coin_three_heads Write a function named flip_coin_three_heads that repeatedly flips a coin until three heads in a row are

Python question in Code step by step

https://www.codestepbystep.com/problem/view/python/loops/flip_coin_three_heads

Write a function named flip_coin_three_heads that repeatedly flips a coin until three heads in a row are seen. You should use a Random object to give an equal chance to a head or a tail appearing. Each time the coin is flipped, what is seen is displayed (H for heads, T for tails). When 3 heads in a row are flipped a congratulatory message is printed. Here is a possible output of a call to your function:

T T T H T H H H Three heads in a row! 

(Because this problem uses random numbers, our test cases check only the general format of your output. You must still examine the output yourself to make sure the answer is correct.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

5. Have you any experience with agile software development?

Answered: 1 week ago