1. Learn
  2. /
  3. Courses
  4. /
  5. Probability Puzzles in R

Connected

Exercise

Writing a simple for loop

Let's write a for loop to repeat a process several times, incrementally storing the results in a vector. We will use the function that we created in the previous exercise to roll dice.

Instructions

100 XP
  • Indicate in the for loop that the index should go from 1 to 10000.
  • Fill in the index for output to store each result.
  • Fill in the argument for roll_dice to roll two dice.