BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Probability Puzzles in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Determine who, if anyone, cashed in both years 1 and 2.
  • Check whether at least one person cashed in both years.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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)
Kodu Düzenle ve Çalıştır