Title: Coin Toss Simulation Topic: Probability Difficulty: Required Skills: Variable assignment, for loops, conditional statements, data types, string concat, random number generation Language: Python

This program will simulate a coin toss a given number of times and calculate the experimental probability for both heads and tails. This can be used to explore how the number of trials affects the experimental probability. Students will be able to see that as the number of trials increases, the experimental probability will get reliably more closer to the theoretical probability of 50/50.

 import randomnumber_of_tosses = 15number_of_heads = 0number_of_tails = 0for x in range(number_of_tosses):    toss = random.randint(0,1)    if toss == 1:        print("Heads!")        number_of_heads += 1    else:        print("Tails!")        number_of_tails += 1print("With " + number_of_tosses + "tosses, the experimental probabilities are:")print("P(heads) = " + str(number_of_heads/number_of_tosses))print("P(tails) = " + str(number_of_tails/number_of_tosses))