01 // DO NOW

// RETRIEVAL PRACTICE

Recall from Lesson 1:

  1. Which Python command outputs text to the console?
  2. Why do we need quote marks " " around text?
  3. What is a Syntax Error?

Self-Correction on next slide -->

01 // DO NOW (ANSWERS)

// VERIFICATION_LOG

  1. Command: print()
  2. Quotes: To tell Python "this is literal text, not code".
  3. Syntax Error: A spelling/grammar mistake in the code.
// LESSON 02 : SELF-GUIDED

02 // MEMORY BANK

Storing Data (Variables)

Use arrow keys or buttons to navigate

03 // MISSION BRIEFING

// OBJECTIVE

To learn how to store, label, and retrieve data in the computer's memory bank using Variables.

// SUCCESS CRITERIA

  • [ ] Create a illegally named variable
  • [ ] Use the Assignment Operator (=)
  • [ ] Avoid the "Quotation Trap" when printing
  • [ ] Build a 3-part variable sequence

04 // THE MEMORY BOX

A Variable is like a labeled box in the computer's memory.

Variables allow the computer to remember things like player scores, health, and names. You give the box a Label and put a Value inside.

Label: "coins"
150

05 // THE ASSIGNMENT PIPE

To put data into a box, we use the = operator.
In Python, = does NOT mean "equals". It means ASSIGN.

// STORING NUMBERS

xp = 500

// STORING TEXT

msg = "Game Over"

// LIVE DEMO ZONE

TEACHERS: Open the IDE. Model creating two variables `a = 10` and `b = 20`. Then show what happens when you do `a = b`. Does A become 20 or B become 10?

06 // THE NAMING LAWS

// VOID IF BROKEN

  • No Spaces allowed
  • Cannot start with a Number
  • Only Underscores _ safe
  • Case Sensitive (hpHP)

// SPOT THE CRASH

1. my score = 50 Hover Illegal Space! Python sees this as two separate things it doesn't recognize. Use my_score.
2. 1st_place = "John" Hover Illegal Start! Variable names must start with a letter.
3. player-hp = 100 Hover Illegal Symbol! Python thinks you are trying to do math (player MINUS hp).

// TEACHER CHECK

Cold-call students to identify the bug in #2 before revealing the tooltip.

07 // THE QUOTATION TRAP

NO QUOTES

health = 100
print(health)
Output: 100

"Look inside the box labeled health"

WITH QUOTES

health = 100
print("health")
Output: health

"Literally print the letters h-e-a-l-t-h"

08 // CONCATENATION

In Python, the + symbol doesn't just add numbers. It can concatenate (join) text together.

word1 = "Fire"
word2 = "ball"
print(word1 + word2)
Output: Fireball

09 // SELF-UPDATING

Variables can be updated by looking at their current value first.

lives = 3
lives = lives - 1
print(lives)
1. Python looks at lives (3)
2. It does the math (3 - 1 = 2)
3. It puts 2 back in the box

10 // TERMINAL TASKS

BRONZE: INVENTORY

1. Create three variables:

  • item = "Shield"
  • qty = 5
  • value = 10.5

2. Print all three variables on separate lines.

SILVER: COMBAT LOG

1. Set hp = 100 and dmg = 25.

2. Update the variable hp so it subtracts the damage.

3. Print a message saying "SYSTEM_UPDATE" then print the new hp.

GOLD: PROFILER

1. Create first and last name variables.

2. Concatenate them with a space between them.

3. Store the result in a new variable called full_name and print it.

// MISSION PROTOCOL

Complete all 3 tasks in your IDE. Once your terminal matches the logic, signal your status for the Mission Dashboard.

11 // MISSION DASHBOARD

// WORKSHEET PHASES

  • 01: Retrieval & Symbols
  • 02: Naming Laws & Logic
  • 03: Bug Hunting & Vaults
  • 04: Construction & Sequencing
  • 05: Mastery Extension

WORKSHEET_SYNC: ACTIVE

Open your Python Worksheet now.

Document all Evidence Codes as you clear each lab sector.

// SESSION ACTIVE : MINIMISE TALKING //

10 // KNOWLEDGE CHECK

// EXIT_TICKET_SEQUENCE

1

What is the result of `score = 10` followed by `score = 5`?

The value 5. The 10 is deleted from memory (overwritten).

2

Why would `player 1 = "John"` fail?

Illegal whitespace. Variables cannot contain spaces.

3

Difference between `print(age)` and `print("age")`?

The first prints the value in the box; the second prints the string "age" literally.