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 OF
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 heads or 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 function to randomly generate a or 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 #generates a random integer
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
