File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -368,15 +368,17 @@ write our own version as an exercise.
368368for any positive integer $n$.
369369
3703702. 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
374374For 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
You can’t perform that action at this time.
0 commit comments