1. Uczyć się
  2. /
  3. Courses
  4. /
  5. Foundations of Probability in R

Connected

Exercise

Waiting for first coin flip

You'll start by simulating a series of coin flips, and "waiting" for the first heads.

Instrukcje

100 XP
  • Simulate 100 instances of flipping a single coin with a 20% chance of heads, and save it as the variable flips. (Thus, flips should be a vector of length 100).
  • Use which() to find the first case where a coin resulted in heads.