7

Lesson 7 of 20 ยท Text Code

Text Code โ€” Part 15

Variables, loops, and if in text form. This is part 15 of 20.

What you'll learn

You will learn to read text-based code and understand that syntax rules (spelling, colons, indentation) matter.

Steps

  1. 1This is text-based code (not block-based). You type it out with words and symbols. Spelling and spacing matter!
  2. 2Notice the colon : after range(3) and the indentation (spaces) before print. These are Python's syntax rules.
  3. 3The loop runs 3 times. The output would be: Line 1, Line 2, Line 3, Done. Can you trace through it?
  4. 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!

๐Ÿ–จ๏ธ

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.

View in Shop

Your Cart (0)

Your cart is empty

Browse our shop to find activities your kids will love

Text Code โ€” Part 15 โ€” Text Code | 5th Grade Coding | LittleActivity | LittleActivity