Skip to content

Commit

Permalink
CE302 Week3 Exercise Class Notes Modified
Browse files Browse the repository at this point in the history
  • Loading branch information
fbezir committed Mar 18, 2021
1 parent b510de7 commit 9399719
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 310 deletions.
223 changes: 53 additions & 170 deletions .ipynb_checkpoints/CE302-Week3-Exercise-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"![](Figures/Shortcuts.png)"
"![](1-Figures/Shortcuts.png)"
]
},
{
Expand All @@ -27,9 +27,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"function"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# TRY it! Verify that np.linspace is a function using the type function. \n",
"# And find how to use the function using the question mark.\n",
Expand All @@ -48,9 +59,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (<ipython-input-3-cb13fcd84768>, line 1)",
"output_type": "error",
"traceback": [
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-3-cb13fcd84768>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m def function_name(argument_1, argument_2, ...):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"def function_name(argument_1, argument_2, ...):\n",
" '''\n",
Expand All @@ -64,12 +84,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# TRY IT! Define a function named my_adder to take in 3 numbers and sum them.\n",
"\n",
"def my_adder(a, b, c):\n",
" \"\"\"\n",
" function to sum the 3 numbers\n",
Expand All @@ -82,32 +100,23 @@
" # this is the summation\n",
" out = a + b + c\n",
" \n",
" return out\n",
"\n",
"# Note That: Indentation is Important"
" return out"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Help on function my_adder in module __main__:\n",
"\n",
"my_adder(a, b, c)\n",
" function to sum the 3 numbers\n",
" Input: 3 numbers a, b, c\n",
" Output: the sum of a, b, and c\n",
" author:\n",
" date:\n",
"\n"
]
}
],
"outputs": [],
"source": [
"my_adder(5,6,7)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"help(my_adder)"
]
Expand Down Expand Up @@ -158,7 +167,7 @@
"source": [
"# EXAMPLE: Run the following function with and without an input.\n",
"\n",
"def print_greeting(day = 'Monday', name = 'Qingkai'):\n",
"def print_greeting(day = 'Monday', name = 'Selim'):\n",
" print(f'Greetings, {name}, today is {day}')"
]
},
Expand Down Expand Up @@ -275,7 +284,7 @@
}
},
"source": [
"![](Figures/Code_2.png)"
"![](1-Figures/Code_2.png)"
]
},
{
Expand Down Expand Up @@ -380,7 +389,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"![](Figures/Code_3.png)"
"![](1-Figures/Code_3.png)"
]
},
{
Expand Down Expand Up @@ -446,7 +455,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"![](Figures/Code_4.png)"
"![](1-Figures/Code_4.png)"
]
},
{
Expand Down Expand Up @@ -478,21 +487,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"![](Figures/Code_5.png)"
"![](1-Figures/Code_5.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](Figures/Code_6.png)\n",
"![](1-Figures/Code_6.png)\n",
"\n",
"![](Figures/Code_7.png)"
"![](1-Figures/Code_7.png)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -510,21 +519,9 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"1\n",
"2\n",
"3\n",
"5\n"
]
}
],
"outputs": [],
"source": [
"print(fibonacci(1))\n",
"print(fibonacci(2))\n",
Expand Down Expand Up @@ -591,7 +588,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -608,34 +605,18 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"22.1 µs ± 659 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
]
}
],
"outputs": [],
"source": [
"%timeit iter_fib(25)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"35.7 ms ± 3.42 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
"outputs": [],
"source": [
"%timeit fibonacci(25)"
]
Expand All @@ -655,104 +636,6 @@
"source": [
"EXAMPLE: Run the following function with and without an input."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
14 changes: 14 additions & 0 deletions .ipynb_checkpoints/GitHub Commands-checkpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## When you study in your local pc or local python directory;

### What you should do to send the changes to main branch is:

- git status : this command will check your status
- git add . : this command will gather all the files
- git commit -m "SomeComment" : you define a commment regarding your study that you want to push to main branch
- git push : by this command, you're even with your main repository.

### What you should do to take the canges from main branch is:
- git status : this command will check your status
- git fetch upstream : you're go and get the changes on the main branch's side
- git merge upstream/main : you're bringing the files to your local pc where github is located
- git push : you're sending those files to your github repository
6 changes: 0 additions & 6 deletions .ipynb_checkpoints/GitHub-Commands-checkpoint.md

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/Shortcuts.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_4.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_5.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_6.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Figures/code_7.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9399719

Please sign in to comment.