Lab 1: Variables and Functions

Open Lab Notebook in Google Colab

Learning Objectives

  1. Become familiar with line-by-line code execution in Python.

  2. Learn the numerical and boolean data types int, float, and bool.

  3. Use arithmetic operators (+, -, …) and comparison operators (<, ==, …).

  4. Use the assignment operator = to create variables.

  5. Write and document functions.

  6. Use if/elif/else clauses and and/or operators to dictate control flow.

Take Your Time

The reading for this lab is longer than usual because there is a lot to cover to get started with a new programming language. If you are new to Python, be patient, work carefully though all of the material, and follow the advice in About This Course > How to Succeed.

AI Settings

Before anything else, follow the instructions at Setting Up Google Colab > Disable Google AI Tools.

AI tools that generate code for you are off limits in this course, see About This Course > Avoid Generative AI.