शुरू करेंमुफ़्त में शुरू करें

Win probability with "switch"

Now let us code the situation where the contestant initially picks Door #1, and then upon the goat reveal, they switch to the remaining door.

Again, first, we will code just one iteration. Then, we will incorporate this into a for loop to run the process repeatedly in order to obtain a simulated estimate of the true win probability.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Probability Puzzles in R

पाठ्यक्रम देखें

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

set.seed(1)
prize <- sample(doors,1)
initial_choice <- 1

# Use the reveal_door function to do the reveal
reveal <- reveal_door(___, ___, ___)

# Switch to the remaining door
final_choice <- ___
print(final_choice)

# Check whether the final choice equals the prize
if(___){
  print("The final choice is correct!")
}
कोड संपादित करें और चलाएँ