From 37f9f81b7db3138bb6ea37bc37b4107fbe02b5f3 Mon Sep 17 00:00:00 2001 From: sooyoung Date: Thu, 15 Sep 2022 09:38:41 -0400 Subject: [PATCH 1/2] learning doc --- 05_docstring/submissions/jeon193.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 05_docstring/submissions/jeon193.py diff --git a/05_docstring/submissions/jeon193.py b/05_docstring/submissions/jeon193.py new file mode 100644 index 0000000..a69c077 --- /dev/null +++ b/05_docstring/submissions/jeon193.py @@ -0,0 +1,14 @@ + +def afunc(array1, array2, mode="+", pow=2): + assert array1.shape == array2.shape, "size mismatch" + assert type(pow) == int, "pow should be type int" + + if mode == "+": + result = array1 + array2 + elif mode == "-": + result = array1 - array2 + else: + raise ValueError(f"mode is either '+' or '-' but got {mode}") + + result = result ** pow + return result From 6136ef98b9413868ab69dcdcaf311a90586927bf Mon Sep 17 00:00:00 2001 From: sooyoung Date: Thu, 15 Sep 2022 09:59:43 -0400 Subject: [PATCH 2/2] learning doc --- 05_docstring/submissions/jeon193.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_docstring/submissions/jeon193.py b/05_docstring/submissions/jeon193.py index a69c077..77f18b7 100644 --- a/05_docstring/submissions/jeon193.py +++ b/05_docstring/submissions/jeon193.py @@ -1,5 +1,5 @@ -def afunc(array1, array2, mode="+", pow=2): +def afunc(array1, array2, mode: str = "+", pow: int = 2): assert array1.shape == array2.shape, "size mismatch" assert type(pow) == int, "pow should be type int"