-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from LDSSA/slu07-functions-basic
SLU07 - Functions: Fundamentals
- Loading branch information
Showing
13 changed files
with
1,796 additions
and
0 deletions.
There are no files selected for viewing
773 changes: 773 additions & 0 deletions
773
Week 04/SLU07 - Functions Fundamentals/Exercise notebook.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
899 changes: 899 additions & 0 deletions
899
Week 04/SLU07 - Functions Fundamentals/Learning notebook.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Small Learning Unit 07 - Functions: Fundamentals | ||
|
||
## What is this Learning Unit (LU) about? 👀 | ||
|
||
As its topic suggests, in this LU you'll get your first exposure to the most fundamental and powerful tool common to all programming languages: FUNCTIONS! | ||
|
||
You'll be introduced to how these are built but by no means will you become an expert in them and that's okay. It takes years to master the composition of functions in each programming language. | ||
|
||
|
||
**If there is one takeaway from this LU, it should be:** | ||
|
||
### Avoid repeating code by using functions 🧠 | ||
|
||
Instead of reapeating code every time you need to use it, you should refactor the code into a function and call that function instead. Refactoring consists on improving the structure of the code, while preserving its goal and behaviour - a very important definition for a programmer stack 🤓 | ||
|
||
That's it. Really. The most common and severe mistake that programmers make is to copy-paste the same code into multiple places rather than converting it into a function. It takes a bit of extra brainpower but, in the end, it always saves more time than it takes. Even though Jupyter notebooks are not that friendly to functions (other IDEs have a lot of automated help when creating functions) let's try and give our best effort in using them! 💪 | ||
|
||
## How to go through this SLU | ||
You are probably already familiar with the process but in case you aren't these are the steps for this LU: | ||
|
||
1. Follow the [Learning Unit Workflow](https://github.com/LDSSA/ds-prep-course-2021#2-learning-unit-workflow) to set up your environment. | ||
2. Go through the Learning Notebook. | ||
3. Do the Exercise notebook, and submit it, as usual. |
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.
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.
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.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
alembic==1.5.8 | ||
appnope==0.1.2 | ||
argon2-cffi==20.1.0 | ||
async-generator==1.10 | ||
attrs==20.3.0 | ||
backcall==0.2.0 | ||
bleach==3.3.0 | ||
certifi==2020.12.5 | ||
cffi==1.14.5 | ||
chardet==4.0.0 | ||
click==7.1.2 | ||
decorator==4.4.2 | ||
defusedxml==0.7.1 | ||
entrypoints==0.3 | ||
fastapi==0.63.0 | ||
fuzzywuzzy==0.18.0 | ||
greenlet==1.0.0 | ||
h11==0.12.0 | ||
idna==2.10 | ||
importlib-metadata==3.9.0 | ||
ipykernel==5.5.0 | ||
ipython==7.22.0 | ||
ipython-genutils==0.2.0 | ||
ipywidgets==7.6.3 | ||
jedi==0.18.0 | ||
Jinja2==2.11.3 | ||
jsonschema==3.2.0 | ||
jupyter==1.0.0 | ||
jupyter-client==6.1.12 | ||
jupyter-console==6.4.0 | ||
jupyter-core==4.7.1 | ||
jupyterlab-pygments==0.1.2 | ||
jupyterlab-widgets==1.0.0 | ||
ldsagrader==0.1.15 | ||
Mako==1.1.4 | ||
MarkupSafe==1.1.1 | ||
mistune==0.8.4 | ||
nbclient==0.5.3 | ||
nbconvert==6.0.7 | ||
nbformat==5.1.2 | ||
nbgrader==0.6.1 | ||
nest-asyncio==1.5.1 | ||
notebook==6.3.0 | ||
packaging==20.9 | ||
pandocfilters==1.4.3 | ||
parso==0.8.1 | ||
peewee==3.14.4 | ||
pexpect==4.8.0 | ||
pickleshare==0.7.5 | ||
prometheus-client==0.9.0 | ||
prompt-toolkit==3.0.18 | ||
psycopg2-binary==2.8.6 | ||
ptyprocess==0.7.0 | ||
pycparser==2.20 | ||
pydantic==1.8.1 | ||
Pygments==2.8.1 | ||
pyparsing==2.4.7 | ||
pyrsistent==0.17.3 | ||
python-dateutil==2.8.1 | ||
python-editor==1.0.4 | ||
pyzmq==22.0.3 | ||
qtconsole==5.0.3 | ||
QtPy==1.9.0 | ||
requests==2.25.1 | ||
Send2Trash==1.5.0 | ||
six==1.15.0 | ||
SQLAlchemy==1.4.3 | ||
starlette==0.13.6 | ||
terminado==0.9.3 | ||
testpath==0.4.4 | ||
tornado==6.1 | ||
traitlets==5.0.5 | ||
typing-extensions==3.7.4.3 | ||
urllib3==1.26.4 | ||
uvicorn==0.13.4 | ||
wcwidth==0.2.5 | ||
webencodings==0.5.1 | ||
widgetsnbextension==3.5.1 | ||
zipp==3.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import requests | ||
import json | ||
|
||
|
||
def submit(slack_id: str, learning_unit: int) -> None: | ||
''' | ||
Submits the notebook to the grades-collector. | ||
param slack_id like "UTS63FC02" | ||
param learning_unit like 0 | ||
''' | ||
data = { | ||
"learning_unit": learning_unit, | ||
"slack_id": slack_id, | ||
"grade": 0, | ||
"metadata": {} | ||
} | ||
response = requests.put( | ||
"https://sub-nb-grades-collector.herokuapp.com/submit", | ||
data=json.dumps(data) | ||
) | ||
print('Success' if response.ok else 'Whoopsie Daisy') |