Lesson goal: Probability with two coins (1)

Previous: Single coin tosses | Home | Next: Two coin tosses (2)

Moving on from tossing a single coin in the last lesson, let's now toss two coins. What we'll do here is to see how many times heads comes up on both coins (HH) versus something different (like HT, TH, or TT).

We'll start by streamlining the code by making a function called toss() which handles all of the tossing mechanics of a coin, just returning a 'h' for heads or 't' for tails.

Now you try. Finish the code, in particular the N= line and the line that looks to see if the toss() function returns an 'h' both times.

Type your code here:


See your results here: