Question: The programming language will be Python/IDLE 5. Develop a solution to flip a coin a given amount of times, and then print the number of

The programming language will be Python/IDLE

5. Develop a solution to flip a coin a given amount of times, and then print the number of heads and the number of tails. The equation to toss the coin is: Coin = Integer(Random * 2) + 1 This is called a simulation question where you use a math function to represent mathematically what you might observe physically, by actually flipping a coin. (20 points) Your solution development should include:

a. PAC

b. Interactivity Chart

c. IPO Chart

d. Algorithms

e. Actual working python code

Additional Info, the goal of the code.

  1. Simulate the coin flipping process by using the Python function random() in a loop that returns a pseudo-random number each time through the loop. See the Python function random() that returns a floating point number (a decimal number) from 0 to just less than
  2. Since the generated random number is a decimal, you need to convert it to an integer using the given equation. This equation will ensure that you either have 1 or 2 after each random call.
  3. Convert that integer number to a head or a tail based on your criterion. (e.g. 1 means heads and 2 means tails)
  4. Repeat steps 1, 2 & 3 the number of times that is given as an input to your function.
  5. With each toss, update the number of heads and tails that you get.
  6. Print the number of heads and tails that you get.

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!