Question: TASK 3 ( OF 4 ) Please write the following python code: A common application for repetition flow is the simulation of a process to

TASK 3(OF 4)
Please write the following python code:
A common application for repetition flow is the simulation of a process to determine the probability of certain events occurring. You did this activity in LabVIEW before. We will now do it using Python.
Create a Python script that will:
prompt the user to specify the number of times to flip a coin (this is your input),
randomly produce a value of 1(heads) or 0(tails)- repeat for each flip of the coin,
record the number of times the coin landed on heads or tails,
output the final percentage of flips that were heads and that were tails.
Note: Use the random library and the random.randint(0 function to randomly generate a 0 or 1 for the coin flip. The command to import the random library should go at the start of your code. The command to generate a random number should go inside of your loop structure.
import random ??#imports the random library
flip = random.randint (0,1)??#generates a random integer
TASK 3 ( OF 4 ) Please write the following python

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 Accounting Questions!