A beginner-friendly repository demonstrating fundamental programming concepts using Python and Jupyter notebooks.
The demonstration notebook showcases three major programming paradigms through practical, easy-to-understand examples. But the real goal of the repository is for you to get comfortable with git/GitHub and your development environment - if you can run the code in the dog_simulation.ipynb
notebook that's a win, even if you don't completely understand it!
The programming_basics.ipynb
notebook demonstrates three different approaches to solving the same problem (making a dog bark) using:
- Procedural Programming - Using functions and step-by-step procedures
- Object-Oriented Programming (OOP) - Using classes and objects to model entities
- Functional Programming - Using pure functions and immutable data
Each example is complete, runnable, and includes detailed explanations to help you understand the core concepts and trade-offs of each programming style.
Choose one of the following options based on your preferred development environment:
- Vocareum
- GitHub codespace
- Local VS Code
A Vocareum cloud virtual machine is provided to Fullstack students. You can run the dog_simulation.ipynb
notebook there by downloading it from this repository and uploading it to your Vocareum environment.
- From this repository's home page go to the
notebooks
directory - Click on the
dog_simulation.ipynb
- Click the small 'Download raw file' icon at the upper left of the notebook preview frame (looks like an arrow pointing down to a horizontal line)
- Save the notebook locally somewhere you will be able to easily find it again
- Go to our course Canvas home page
- In the 'Resources and Lab' section, go to
BC Jupyter Lab
- Click 'Load BC Jupyter Lab in a new window', then start your Vocareum environment
- Once the Jupyter lab interface has loaded, upload the notebook file by clicking the 'Upload Files' icon at the top of the file browser (looks like a arrow pointing up from a horizontal line)
- Click on the notebook in the file browser to open the notebook
- You can now:
- Read through the markdown cells (text sections)
- Run code cells by clicking the
▶️ Run button next to each cell or pressingShift + Enter
- Experiment with the code by making changes
GitHub Codespaces provides a complete, cloud-based development environment with everything pre-configured. No local installation required!
- Go to this repository on GitHub:
https://github.com/gperdrizet/programming_basics
- Click the "Fork" button in the top-right corner of the page
- This creates your own copy of the repository in your GitHub account
- On your forked repository page, click the green "Code" button
- Switch to the "Codespaces" tab
- Click "Create codespace on main"
- Wait for the codespace to build (this may take a minute or two)
- A browser-based VS Code environment will open with everything ready to go!
- In the VS Code file explorer (left sidebar), navigate to the
notebooks
folder - Click on
dog_simulation.ipynb
to open it - You can now:
- Read through the markdown cells (text sections)
- Run code cells by clicking the
▶️ Run button next to each cell or pressingShift + Enter
- Experiment with the code by making changes
Note: All dependencies are pre-installed in the codespace, so you can start coding immediately!
Follow these step-by-step instructions to set up the repository on your local machine. Don't worry if you're new to Git or Jupyter - we'll walk through everything!
Before starting, make sure you have:
- VS Code installed on your computer
- Git installed on your computer
- Python installed (version 3.10 or higher)
- Go to this repository on GitHub:
https://github.com/gperdrizet/programming_basics
- Click the "Fork" button in the top-right corner of the page
- This creates your own copy of the repository in your GitHub account
- Open VS Code
- Open the Terminal in VS Code: View → Terminal (or press
Ctrl+``
) - Navigate to where you want to store the project (e.g.,
cd Desktop
orcd Documents
) - On your forked repository page on GitHub, click the green "Code" button
- Copy the URL (it should look like:
https://github.com/YOUR-USERNAME/programming_basics.git
) - Back in the VS Code terminal, run the clone command:
git clone https://github.com/YOUR-USERNAME/programming_basics.git
- Enter the project directory:
cd programming_basics
- In VS Code, go to File → Open Folder (or press
Ctrl+K, Ctrl+O
on Windows/Linux orCmd+K, Cmd+O
on Mac) - Navigate to and select the
programming_basics
folder you just cloned - Click "Select Folder" to open the project
- In VS Code, click on the Extensions icon in the sidebar (or press
Ctrl+Shift+X
) - Search for "Jupyter"
- Install the Jupyter extension by Microsoft (it should be the first result)
- Wait for the installation to complete
A virtual environment keeps your project dependencies isolated from other Python projects.
-
Open the Terminal in VS Code: View → Terminal (or press
Ctrl+``
) -
Make sure you're in the
programming_basics
directory (you should see it in the terminal prompt) -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
On Windows:
venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
You should see
(venv)
appear at the beginning of your terminal prompt, indicating the virtual environment is active.
- With your virtual environment activated, install the required packages:
This installs
pip install -r requirements.txt
ipykernel
, which allows VS Code to run Jupyter notebooks.
- In the VS Code file explorer, navigate to the
notebooks
folder - Click on
dog_simulation.ipynb
to open it - You can now:
- Read through the markdown cells (text sections)
- Run code cells by clicking the
▶️ Run button next to each cell or pressingShift + Enter
- Experiment with the code by making changes
- Read First: Start by reading the markdown cells (text sections) to understand each concept
- Run Code: Execute each code cell in order by pressing
Shift + Enter
- Experiment: Try modifying the code to see how it affects the output
- Compare: Notice how each programming paradigm solves the same problem differently
VS Code can't find Python or the kernel?
- Make sure your virtual environment is activated (you should see
(venv)
in the terminal) - Try restarting VS Code after creating the virtual environment
- In the notebook, click on the kernel selector (top-right) and choose the correct Python interpreter
Virtual environment activation not working?
- On Windows, try:
venv\Scripts\Activate.ps1
(PowerShell) orvenv\Scripts\activate.bat
(Command Prompt) - Make sure you're in the
programming_basics
directory when creating/activating
Windows users seeing security or script execution errors?
- If you see errors about "running scripts is disabled" or security policies when activating the virtual environment, make sure you're using a Command Prompt (cmd) terminal, not PowerShell
- In VS Code, you can change your default terminal by clicking the dropdown arrow next to the + icon in the terminal panel and selecting "Command Prompt"
Jupyter extension not working?
- Try reloading VS Code: View → Command Palette → "Developer: Reload Window"
- Make sure you have the official Jupyter extension by Microsoft installed
Need help with Git?