2
Lesson 2 of 20 · Text Code
Text Code — Part 10
Variables, loops, and if in text form. This is part 10 of 20.
What you'll learn
You will learn to read text-based code and understand that syntax rules (spelling, colons, indentation) matter.
Steps
- 1This is text-based code (not block-based). You type it out with words and symbols. Spelling and spacing matter!
- 2Notice the colon : after range(3) and the indentation (spaces) before print. These are Python's syntax rules.
- 3The loop runs 3 times. The output would be: Line 1, Line 2, Line 3, Done. Can you trace through it?
- 4Reading code is a skill. Practice by going line by line and predicting what the output would be BEFORE checking!
Key Terms
- Text code
- Code written as words and symbols. Python is text code. Spelling and indentation matter.
- Syntax
- The rules for how to write code correctly (colons, indentation, etc.).
- Indent
- Adding spaces at the start of a line. Code inside a loop or if must be indented.
Python 3
Output
Loading Python... This may take a few seconds.
Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!
Ready?
Text Code — Part 10
You will learn to read text-based code and understand that syntax rules (spelling, colons, indentation) matter.
Full screen — no distractions
🖨️View in Shop
Checkout complete lesson on Text Code for 5th Grade
Get the full Text Code track as a printable PDF — all lessons, worksheets, and answer keys.
