This guide walks you through everything you need to know for Module 1. Follow along in class and use this as a reference when you’re practicing on your own. By the end of Module 1, you should be comfortable writing simple Python expressions, working with variables, and writing your first complete program in VS Code.
Module 1.1: Getting Started & the Interactive Shell
What You’ll Be Able to Do
- Explain, in your own words, what programming is and why we use Python.
- Open and use Python’s interactive shell inside VS Code.
- Evaluate simple math expressions in the shell.
Key Concepts
Programming is how we give a computer step-by-step instructions. Python is a popular language for beginners because its code reads a lot like plain English.
You’ll write and run Python code using Visual Studio Code (VS Code).
Python can act like a calculator. Try typing expressions into a new script:
print(``2 + 2)``print(``10 - 4)``print(``3 * 5)``print(``10 / 3)``print(``10 // 3)``print(``10 % 3)``print(``2 ** 8)
Operators, from the examples above:
-
- , - → addition, subtraction
-
- → multiplication
- / → division (always returns a decimal)
- // → integer division (drops the remainder - truncates)
- % → modulus (gives you the remainder)
- ** → exponent (“to the power of”)
Python follows the standard order of operations (parentheses, exponents, multiplication/division, addition/subtraction).
Practice
- Create a new Python script in VS Code.
- Before pressing Play, predict the answer to each expression above — then check yourself.
- Write and evaluate 8-10 of your own expressions, using at least four different operators.
Module 1.2: Data Types & Strings
What You’ll Be Able to Do
- Identify whether a value is an integer, a float, or a string.
- Combine strings using concatenation and replication.
- Recognize and fix a common TypeError caused by mixing data types.
Key Concepts
Every value in Python has a data type. The three you’ll use constantly are:
- int (integer) - a whole number, like 7 or -3
- float (floating-point) - a number with a decimal point, like 3.14
- str (string) - text, always wrapped in quotes, like ‘hello’ or “hello”
You can combine strings with the + operator (concatenation) and repeat them with the * operator (replication):
'Hello, ' + 'World!'``'ha' * 3
Python won’t let you combine a string and a number with +. This will cause an error:
'I am ' + 25 + ' years old'``# TypeError: can only concatenate str (not "int") to str
To fix it, convert the number to a string first using str():
'I am ' + str(25) + ' years old'
Practice
- Sort these values by data type: int, float, or str: 7, ‘seven’, 7.0, ‘7’, -3, 3.14
- In a script, concatenate and replicate a few strings of your own.
- You’ll be given a short line of broken code that mixes a string and a number — find the error and fix it using str().
Module 1.3: Variables & Assignment Statements
What You’ll Be Able to Do
- Explain what a variable is and why programs use them.
- Write valid assignment statements.
- Follow Python’s variable naming rules.
Key Concepts
A variable is a name that stores a value so you can use it again later. Think of it as a labeled box holding whatever value you put inside it.
You create a variable with an assignment statement:
age = 15``name = 'Alex'``price = 19.99
You can change a variable’s value at any time by assigning it something new — this overwrites the old value:
score = 10``score = 20``print(score) # prints 20
Variable naming rules:
- Can only contain letters, numbers, and underscores (no spaces or symbols)
- Cannot start with a number
- Is case-sensitive (age and Age are different variables)
- Should not use Python’s reserved words (like print or if)
Practice
- Create three variables of your own, using at least one int, one float, and one string.
- Predict the final value of a variable after a short sequence of assignment statements (worksheet provided in class).
- Use two of your variables together inside a single expression.
Module 1.4: Writing Your First Program
What You’ll Be Able to Do
- Write and run a complete Python program in VS Code.
- Use print(), input(), and comments correctly.
- Use len() and the str() / int() / float() conversion functions.
Key Concepts
So far you’ve been typing one line at a time into a script. Now you’ll save a full program as a .py file in VS Code and run the whole thing at once.
Key building blocks:
- print() displays text or values on the screen.
- input() pauses the program and waits for the user to type something, then stores what they typed.
-
starts a comment — a note for humans that Python ignores when running the program.
- len() tells you how many characters are in a string.
- str(), int(), and float() convert a value from one data type to another.
Example program:
# This program creates a fun fact about you``print('What is your favorite animal?')``favAnimal = input()``print('The ' + favAnimal + ' is a great choice!')``print('Your favorite animal has ' + str(len(favAnimal)) + ' letters in its name.')
Practice
- In VS Code, create a new file named module1_greeting.py.
- Type the example program above, then run it and confirm it works.
- Add a comment above each line explaining what that line does.
- On your own: write a new program that asks for the user’s name and age, then prints a personalized message using both.
Module 1.5: Practice & Review
What You’ll Be Able to Do
- Apply everything from Module 1 — expressions, data types, variables, print/input — without step-by-step instructions.
Key Concepts
Module 1 covered a lot: math operators, data types and strings, variables and assignment statements, and writing/running a full program with print(), input(), comments, and type conversion.
Before moving on to Module 2 (Flow Control), you should be able to write a short program from scratch using these tools without looking anything up.
Practice
- Complete the Module 1 review questions provided in class.
- Mini challenge: write a short program (for example, a simple “Mad Libs” or personal-info program) that uses at least one variable, print(), input(), and a comment.
- Be ready to briefly walk a classmate or me through how your program works.