Python Fundamentals
WoCCode Summer Bootcamp 2023
What we WILL cover
What we WON’T cover
Free online Python tutorials:
Jupyter Notebook: Download Method 1
Step 3 (in terminal):
git clone git@github.com:woccode/summer-bootcamp-2023.git
cd summer-bootcamp-2023/Session-2/
jupyter notebook 2-PythonFundamentals.ipynb
Step 1: click
Step 2: copy�SSH or HTTPS
Done
Just watching
Need help
Jupyter notebook: Download Method 2
Step 2 (in terminal):
cd ~/Downloads/
jupyter notebook 2-PythonFundamentals.ipynb
Step 1: Click to download
Let’s get started! Built-in Python objects
Covered:
Not covered (see linked resources):
A pause to consider Python Namespaces
import kungfu
import kungfu as kf
from kungfu import kick
KF
GOOD PRACTICE TIP:
Let’s get into Math: Introduction to Numpy
When you:
import numpy as np
you can access numpy libraries with the prefix np.
For example,
x = np.array([1., 2., 3.])
see Jupyter notebook example
Defining Functions – and more importantly – DocStrings
Scripting in Python - example code
If you did not clone the repo, download here
Done
Just watching
Need help
Scripting in Python
First line needed to execute it from command line.
Import libraries and write code as usual.
Put special numbers and global settings at the top
Scripting in Python
Scripting in Python
Another option:
python taylor_expansions.py 10
Importing your own Python libraries - Method 1
Importing your own Python libraries - Method 1
To make it permanent, include the export command in your�.bashrc (Linux) or .bash_profile (MacOS) file