Skip to content

Commit 892af91

Browse files
committed
Adding more explanations to exercise
1 parent d5f3256 commit 892af91

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lectures/functions.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,17 @@ write our own version as an exercise.
368368
for any positive integer $n$.
369369
370370
2. In addition, try to add a new argument for your function.
371-
The argument will take in a lambda expression f that transforms n to $f(n) = n^2 + 1$ if n is even, and $f(n) = n^2$ if n is odd.
372-
The default value will be $f(n) = n$.
371+
The argument takes a function `f` that transforms n to $f(n) = n^2 + 1$ if n is even, and $f(n) = n^2$ if n is odd.
372+
The default value should be $f(n) = n$.
373373
374374
For example
375375
376376
- The default case `factorial(3)` should return $3!$
377377
- `factorial(3,f)` should return $9!$
378378
- `factorial(2,f)` should return $5!$
379379
380+
Try to use lambda expressions to define the function `f`.
381+
380382
```
381383

382384
```{solution-start} exercise_1

0 commit comments

Comments
 (0)