Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
raldone01 committed Nov 25, 2024
1 parent 3d64b1a commit 78c0789
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions lesson_0_comments.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -46,9 +46,7 @@
"output_type": "stream",
"text": [
"3\n",
"10\n",
"5\n",
"24\n"
"10\n"
]
}
],
Expand All @@ -59,23 +57,35 @@
"\n",
"\n",
"def add(*args, **kwargs):\n",
" # get the comment arguments\n",
" c_args, c_kwargs = comment_arguments()\n",
" # parse integers\n",
" input_ints = [int(i) for i in args + c_args]\n",
" # sum integers\n",
" result = sum(input_ints)\n",
" return result\n",
" return sum([int(i) for i in args + c_args])\n",
"\n",
"\n",
"# Go ahead and change the comments.\n",
"# See how python uses them as arguments.\n",
"# See how they are used as arguments.\n",
"\n",
"result = add() # 1, 2\n",
"print(result)\n",
"# comment arguments can be combined with normal function arguments\n",
"result = add(1, 2) # 3, 4\n",
"print(result)\n",
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5\n",
"24\n"
]
}
],
"source": [
"result = add(\n",
" add(1) # 2\n",
") # 2\n",
Expand Down

0 comments on commit 78c0789

Please sign in to comment.