<jupyter_start><jupyter_text>Now You Code 3: Coin FlipsWrite a program to simulate 100,000 coin flips. The program should outputthe tally of heads and tails across the number of flips.For Example:After 100000 flips. Heads: 50030, Tails 49970Of course, since the flips are random, the counts will vary each time the program executes.Your strategy should be to use a loop to flip a coin 100,000 times.After you flip you should check for heads or tails and increment the countaccordingly. How do you make Python simulate a coin flip?<jupyter_code># Sample code which demostrates how to flip a coin in python
import random 
coin = ['heads', 'tails']
flip = random.choice(coin)
print(flip)<jupyter_output>heads<jupyter_text>Run the cell above a couple of times. Notice how each time you execute the code, it comes up as either `heads` or `tails`.Here's a breakdown of the code```line 1 imports the random moduleline 2 sets up a coin to have two choices heads or tailsline 3 "flips" a coin by making a random choice among the values of the coin ('heads' or 'tails')line 4 prints the results of the coin flip.```Now that you understand how to simulate a coin flip a Python, try to design then write code for the program.  Step 1: Problem Analysis Inputs:Outputs:Algorithm (Steps in Program):<jupyter_code>import random
# Step 2: write code for program
num = int(input("How many times should I flip?"))
count = 0

while num >= count:
    coin = ['heads', 'tails']
    flip = random.choice(coin)
    print(flip)
    count = count + 1<jupyter_output>How many times should I flip?100
heads
tails
tails
tails
heads
heads
tails
heads
heads
tails
heads
heads
heads
tails
heads
tails
tails
tails
tails
tails
tails
tails
tails
heads
heads
tails
heads
heads
tails
tails
tails
heads
heads
tails
heads
tails
heads
tails
heads
tails
tails
heads
tails
heads
tails
tails
heads
heads
tails
heads
heads
tails
heads
heads
tails
tails
heads
tails
tails
heads
heads
heads
tails
heads
tails
tails
tails
tails
tails
heads
heads
heads
tails
heads
tails
heads
tails
heads
heads
heads
tails
tails
tails
tails
heads
tails
heads
heads
heads
heads
tails
tails
heads
heads
heads
heads
tails
heads
tails
heads
tails<jupyter_text>Step 3: Questions1. Which loop did you use to solve the problem? What is a definite or indefinite loop?2. Modify this program to allow you to input the number of times you would like to flip the coin. NOTE: if you enter a large number, the program could take a few minutes to execute. Be Patient!!!3. Explain how could this progam could be modified to track flipping a "three" sided coin with `heads`, `tails` and `foos` for example? Do not modify the code, only explain your strategy.  Reminder of Evaluation Criteria1. What the problem attempted (analysis, code, and answered questions) ?2. What the problem analysis thought out? (does the program match the plan?)3. Does the code execute without syntax error?4. Does the code solve the intended problem?5. Is the code well written? (easy to understand, modular, and self-documenting, handles errors)<jupyter_code>1) While loop. Definite.
3) Add a third varible<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05295055821371611, 'fraction_numerical': 0.016267942583732056, 'mean_word_length': 4.818181818181818, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '577174', 'license': 'MIT', 'n_tokens_mistral': 997, 'n_tokens_neox': 874, 'n_words': 483, 'path': 'content/lessons/05/Now-You-Code/NYC3-Coin-Flip.ipynb', 'repo_name': 'MahopacHS/spring2019-terminem0222', 'size': '3135'}