Summary and Schedule
This is a new lesson built with The Carpentries Workbench.
| Setup Instructions | Download files required for the lesson | |
| Duration: 00h 00m | 1. Executing Python Code |
What is the difference between executing code in an interactive
environment vs. a script? What is the Python REPL and how do you start it? How do you execute Python code in the REPL? How do you write and run Python scripts from the command line? How do you comment out code in Python? |
| Duration: 00h 20m | 2. Types and Operators |
“Python has types?” “How do you check the type of a variable?” “What are the basic data types in Python?” “How do you convert between different data types?” “What are the rules for naming variables in Python?” |
| Duration: 00h 45m | 3. Loops and Logic |
How do I use loops to repeat code in Python? What are the different types of loops in Python and when should I use each one? What are the main logical operators in Python and how do they work? |
| Duration: 01h 10m | 4. Functions, Functions, Functions |
Why are functions useful in programming? How are functions defined in Python? What is the difference between a function definition and a function call? How do you pass arguments to a function in Python? |
| Duration: 01h 40m | 5. Bonus Challenges | |
| Duration: 01h 40m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Python is an “interpreted”1, object-oriented, imperative, high-level, multi-paradigm programming language. As opposed to a compiled language like Fortran or C, an “interpreted” language like Python is a programming language which executes code without the need to first compile a program into “machine-language”. Since there is no compilation step, the testing and debugging cycle is quite fast.
Python has become one of the most popular programming languages in the world in recent years. Python’s simple, easy to learn syntax emphasizes readability, so it is one of the “easier” languages to learn when beginning to program. It can be used for machine learning, website development, data science, task automation, and much more. In high-performance computing, Python is heavily used to analyze scientific data on the system.
This lesson is meant to give you experience with some of the basic foundation of the Python language. There is much more to Python than what is included in this lesson, but what is provided will hopefully set you on the right path. We will specifically be using “Python 3” syntax in this lesson (as opposed to “Python 2”). For additional help and topics, be sure to check out the Reference section.
You need to understand how to use the command line, have an editor (e.g., neovim, VS Code, etc.) installed on your system, and have Python installed on your computer. If you do not have Python installed, please follow the instructions in the Software Setup section below.
Software Requirements
This lesson requires Python (version 3.10 or newer recommended) along with a interactive shell environment and a text editor.
Check your Python version by running the following command(s) in your terminal:
For more information about using the uv command, see the
Python
Programming with uv lesson.
Download Practice Scripts
Download the lesson scripts archive and unzip it to your Desktop
An “interpreted” language means that the code is executed directly by an interpreter, without a separate compilation step. This allows for faster development and testing cycles, as you can run code immediately without waiting for a compilation process. As such, interpreted languages are often favored for scripting, rapid prototyping, and interactive use. Calling Python an “interpreted” language is a simplification, as it actually compiles code to bytecode before execution, but the key point is that this process is transparent to the user and does not require a separate compilation step. ↩︎