Commit d1bbbe7a authored by paugier's avatar paugier
Browse files

Fix pres function (without unittest)

parent b7a59175
Pipeline #32463 passed with stage
in 51 seconds
......@@ -49,12 +49,10 @@
%% Cell type:code id: tags:
``` python
import unittest
def add(arg0, arg1):
"""Print and return the sum of the two arguments (duck typing)."""
result = arg0 + arg1
print('result = ', result)
return result
......@@ -88,23 +86,20 @@
Write a function that returns the sum of the first argument with twice the second argument.
%% Cell type:code id: tags:
``` python
import unittest
def add_second_twice(arg0, arg1):
"""Return the sum of the first argument with twice the second one.
Arguments should be of type that support sum and product by
an integer (e.g. numerical, string, list, ...)
:param arg0: first argument
:param arg1: second argument
:return: arg0 + 2 * arg1
"""
pass
```
%% Cell type:markdown id: tags:
### Do it yourself: simple function definition
......@@ -124,11 +119,11 @@
"""
result = arg0 + 2*arg1
print(f'arg0 + 2*arg1 = {arg0} + 2*{arg1} = {result}')
return result
myfunc(4, 6)
add_second_twice(4, 6)
```
%%%% Output: execute_result
16
......@@ -137,14 +132,10 @@
``` python
myfunc('a', 'b')
```
%%%% Output: execute_result
'abb'
%% Cell type:markdown id: tags:
## Is the function correct ?
- What does it means **correct** ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment