All labs
beginnerPython
Python: Your First Program
You will learn to
- Print output and assign values to variables of different data types
- Format strings dynamically using f-strings
- Perform mathematical operations
- Control flow using if/elif/else statements
- Iterate over sequences using for-loops and lists
Before you start
- No experience needed
- The in-browser Jupyter Sandbox (embedded below)
Your workspace
The notebook runs entirely in your browser (JupyterLite). The first load downloads the Python runtime, give it a minute on slow connections, then it is cached. Use the upload arrow in the file panel to add datasets.
Step-by-step
1. Hello, World!
Done when: The output immediately below the cell shows your greeting2. Variables and Data Types
Done when: You have successfully stored string, integer, and float data in memory3. Dynamic text with f-strings
Done when: A complete, dynamically generated sentence prints to the screen4. Maths and operators
Done when: Python correctly calculates and prints your birth year5. Making decisions with If Statements
Done when: The correct branch prints based on the value of your age variable6. Iterating with For Loops
Done when: The notebook prints a sentence for every item in your list
Finished every step?
Reflect
- What happens if you forget to indent the code inside an `if` statement?
- How does Python know that `age = 25` is an integer and not a string?
- Why are f-strings useful compared to manually adding strings together with `+`?

