Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions