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
Note: some computers come with Python 2 preinstalled. For this course, you'll need Python 3.6 or higher version (like 3.10).
Go to https://www.python.org/downloads/
Mac/Linux: Follow the prompts and install using the default settings.
Windows:
-
You're installing Python now - instructions
-
You've already installed Python - instructions
Download the free, community edition 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/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 PyCharm below
On a Mac:
- Go to PyCharm > Preferences
On a PC:
- Go to File > Settings
Once in Settings:
- Go to Project: python-foundations-3-weeks > Project Interpreter
- Look for your Python version in the Project Interpreter dropdown and select it. Please use Python 3.6 or higher.
- If you found it, click OK and try running
example_1_first_code
again - Otherwise, if your version wasn't there, click gear icon > Add...
- In the new window, select System Interpreter on the left, and then look for the Python version in the dropdown
- If it's not there, click the ... button and navigate to your Python location
- Note: For this last step, you may have to search the internet for where Python gets installed by default on your operating system
If you are having trouble configuring your Python version, you can find visual instructions here: Python interpreter setup
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
Video lesson 2 - Next Level Python
Getting started with Python
Run Python in interactive and script mode
Interactive scenario 1 (steps 1 & 2) / Video 1 lesson 1.2 (0:00 - 2:00 and 12:00 - 13:45)
Using operators and importing the math
module
Interactive scenario 1 (steps 3 - 5) / Video 1 lesson 2.1 (2:00 - 12:00)
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.7
Defining your own functions
Interactive scenario 3 (step 1) / Video 1 lesson 2.6
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