Skip to content

Commit ebdcacc

Browse files
committed
fix composition example
1 parent 4ada452 commit ebdcacc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

11_functional_programming.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@
422422
"\n",
423423
"<div class=\"alert alert-block alert-warning\">\n",
424424
" <h4><b>Question</b></h4>\n",
425-
" Inside the solution function below, write the solution of equation <code>x^2 + y^2</code>, using lambda expressions.\n",
425+
" Inside the solution function below, write the solution of equation <code>x^2 + y^2</code>, using composition.\n",
426426
"</div>"
427427
]
428428
},
@@ -444,7 +444,7 @@
444444
"%%ipytest\n",
445445
"\n",
446446
"def solution_composition(x: int, y: int):\n",
447-
" \"\"\"A function that solves the equation x^2 + y^2, using lambda functions.\n",
447+
" \"\"\"A function that solves the equation x^2 + y^2, using composition.\n",
448448
"\n",
449449
" Args:\n",
450450
" x: the first integer\n",

tutorial/tests/test_11_functional_programming.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ def reference_composition(x, y):
4242
def square(x: int) -> int:
4343
return x * x
4444

45-
def sum(x: int, y: int) -> int:
45+
def add(x: int, y: int) -> int:
4646
return x + y
4747

48-
eq = lambda x, y: sum(square(x), square(y))
48+
def eq(x: int, y: int) -> int:
49+
return add(square(x), square(y))
4950

5051
return eq(x, y)
5152

0 commit comments

Comments
 (0)