Skip to content

Commit c101e4b

Browse files
committed
update exercise solution env
1 parent 856f170 commit c101e4b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lectures/monte_carlo.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,20 @@ compute_call_price()
584584

585585
## ExerciseS
586586

587+
```{exercise}
588+
:label: monte_carlo_ex1
589+
587590
We would like to increase $M$ in the code above to make the calculation more
588591
accurate.
589592
590593
But this is problematic because Python loops are slow.
591594
592595
Your task is to write a faster version of this code using NumPy.
596+
```
593597

594-
598+
```{solution-start} monte_carlo_ex1
599+
:class: dropdown
600+
```
595601

596602
```{code-cell} ipython3
597603
def compute_call_price(β=β,
@@ -628,3 +634,6 @@ Now let's try with larger $M$ to get a more accurate calculation.
628634
%%time
629635
compute_call_price(M=10_000_000)
630636
```
637+
638+
```{solution-end}
639+
```

0 commit comments

Comments
 (0)