This is the code for the O'Reilly Live Training - Hands-on Python Foundations in 3 Weeks presented by Arianne Dee
Before the class, please follow these instructions:
- Install Python
- Install PyCharm
- Install Git
- Clone the code
- Make sure that you can run Python in PyCharm
There is an Outline and resources section at the end with lab and video links.
More detailed instructions can be found here: Installing Python
For this course, you'll need Python 3.6 or higher version (like 3.13).
Go to https://www.python.org/downloads/
Mac/Windows: Follow the prompts and install using the default settings.
Other OS: Use your package manager or search online for how to install Python.
Once installed, you to run Python in the command line:
- Mac/Linux: use
$ python3
to launch the Python Console - Windows: use
C:\> py
to launch the Python Console
Additional instructions here: Get a code editor
Download PyCharm. https://www.jetbrains.com/pycharm/download/
Install, open, and use the default settings.
Follow your operating system instructions if you don't already have Git installed: Git install instructions
Get the code for this course using Git.
Option 1
If you aren't familiar with Git, you can use PyCharm to clone a Git repository.
In PyCharm, when choosing which project to open, choose "Get from VCS" (clone from Git, which is a version control system)
Option 2
If you know Git, clone the repository and then open the python-foundations-3-weeks
folder in PyCharm.
With the python-foundations-3-weeks
folder open in Pycharm:
-
In the left panel, navigate to
examples/week_1/example_1_first_code.py
and double click to open it in the editor -
On the open file, right click and select Run 'example_1_first_code'
-
In the Run tab on the bottom, you should see
Process finished with exit code 0
-
Otherwise, if you got an error (exit code 1 in red), follow the instructions for setting your Python version in your IDE here
See step-by-step instructions here:
Rough week-by-week outline with links to relevant interactive scenarios and pre-recorded video lessons.
Interactive scenario list - Hands-On Python Foundations Scenarios
Video lesson 1 - Introduction to Python 2nd Ed
Video lesson 2 - Next Level Python
Getting started with Python
Install Python - Video 1 lesson 1.1
Choose a code editor - Video 1 lesson 1.2
Run Python in interactive and script mode
Interactive scenario 1 (steps 1 & 2) / Video 1 lesson 1.2 (6:16 to end)
Using operators and importing the math
module
Interactive scenario 1 (steps 3 - 5) / Video 1 lesson 1.3
Working with variables, naming rules and keywords
Interactive scenario 2 (step 1) / Video 1 lesson 2.2
Basic data types, errors and type casting
Interactive scenario 2 (steps 2 - 4) / Video 1 lesson 2.1 and Video 1 lesson 2.3
String concatination, formatting and interpolation
Interactive scenario 2 (steps 5 & 6) / Video 1 lesson 2.4
Defining your own functions
Interactive scenario 3 (step 1) / Video 1 lesson 2.7
True and false expressions, comparisons and methods
Interactive scenario 3 (step 2) / Video 1 lesson 3.2
If-elif-else statements
Interactive scenario 3 (step 3) / Video 1 lesson 3.3
While and for loops
Interactive scenario 3 (step 4) / Video 1 lesson 4.1 (while loops) and Video 1 lesson 4.4 (for loops)
Writing simple scripts
Interactive scenario 4 (step 1) / Video 1 lesson 4.3
Interactive scenario 4 (step 2) / Video 2 lesson 1.3
Interactive scenario 4 (steps 3 & 4) / Video 1 lesson 5.2
Catching and throwing errors/exceptions
Interactive scenario 5 (steps 1 & 2) / Video 2 lesson 1.4
Reading and writing to text files and CSV files
Interactive scenario 5 (steps 3 - 5) / Video 2 lesson 2 (lessons 2.1 - 2.3)
Making GET and POST requests using the requests
library
Interactive scenario 5 (steps 1 & 4) / Video 2 lesson 7.1
Getting data from APIs
Interactive scenario 5 (steps 2, 3 & 5) / Video 2 lesson 7.5
No interactive scenario / Video 2 lesson 3.1
No interactive scenario or video lesson
Code examples in
examples/week_2/example_23_args.py
and
examples/week_2/example_24_click.py
Working with real-world applications
Installing external packages with pip
Interactive scenario 7 (steps 2 - 4) / Video 2 lesson 3.2
Managing project environments with venv
Interactive scenario 7 (step 5) / Video 2 lesson 3.3
Connecting PyCharm to your virtual environment: instructions
Working with venv
, git and GitHub
No interactive scenario / Video 2 lesson 3.4 and 3.5
Using and creating classes
Interactive scenario 8 / No video lesson
Understanding dunder methods
Interactive scenario 8 step 2 / No video lesson
Imports, init.py, namespaces, scope and name.
Interactive scenario 9 / Video 2 lesson 5
Options for storing your code on the internet.
No interactive scenario / Video 2 lesson 9
No, Python 2 is out of date. Please download a version that is at least Python 3.6.
Yes, but it is only recommended if you are already know it and are comfortable navigating to different files and running commands in the command line. If it has syntax highlighting for Python, that is ideal.
If you are using VS Code, make sure the Python plugin is installed.
Follow the instructions for Python interpreter setup