Two consecutive years
First, let us see how common it is for someone to cash two years in a row.
Here, we will assume just 60 entrants, with cash awarded to the top 6. Each player is represented by a number from 1 through 60.
This exercise is part of the course
Probability Puzzles in R
Exercise instructions
- Determine who, if anyone, cashed in both years 1 and 2.
- Check whether at least one person cashed in both years.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
players <- c(1:60)
count <- 0
for(i in 1:10000){
cash_year1 <- sample(players, 6)
cash_year2 <- sample(players, 6)
# Find those who cashed both years
cash_both <-
# Check whether anyone cashed both years
if(___){
count <- count + 1
}
}
print(count/10000)