Bootcamp Curriculum • 5 Modules • 12 Chapters • Multi-Language Runner (Python, JS, Java, C++) • Interactive Memory Trace • AI Mentor
CHAPTER 01 · FOUNDATIONS5 min read

Variables, input & output

Every program starts with remembering things: names, scores, choices. Variables give those values a label in computer memory so you can reuse, combine, and manipulate them.

By the end of this chapter, you can:
  • Assign and re-assign values in memory using variables.
  • Combine strings and values using concatenation.
  • Implement the classic Band Name Generator logic combining city and pet name.
Explanation DepthTailor the level of detail to your learning goal
💻 Standard College Notes

Variables bind human-readable identifiers to memory addresses.

In Python, variable assignment is dynamic: you do not need to declare types upfront like in Java (String name = '...') or C++. Python infers the type automatically at runtime.

💡Identifiers must start with a letter or underscore, cannot contain spaces, and are case-sensitive.

A name for something worth remembering

A variable connects an identifier name to a value stored in RAM. In Python, assignment happens from right to left using a single equals sign.

example_1.py
Ctrl + ↵ to run
Terminal Output
Ready to execute
Click "▶ Run Code" or press Ctrl+Enter to compile & run this snippet.

Band Name Generator logic

Day 1 culminates in combining inputs into an exciting creative output: take the city you grew up in and your favourite pet to generate your band name!

example_2.py
Ctrl + ↵ to run
Terminal Output
Ready to execute
Click "▶ Run Code" or press Ctrl+Enter to compile & run this snippet.
✦ Interactive Dry-Run Visualizer

Memory Trace: Variable Assignment & Band Name Generation

Follow how RAM allocates variable labels and joins strings in memory.

STEP1 / 4
1city = "Bristol"👉 Executing
2pet = "Luna"
3band = city + " " + pet
4print(band)
VariableValue in MemoryData Type
city"Bristol"str (String)
Memory allocates space for 'city'

Text 'Bristol' is stored in memory address bound to label 'city'.

Console Stream (stdout)
(No output generated yet)
Line 1: city = "Bristol"

🔧 TypeError: String and Integer Concatenation

A student tried to build an intro message combining their name and age, but the program crashed with a TypeError.

⚡ +100 XP
fix_bug.pyPython 3.10
⚡ Quick Revision Quiz

Predict The Output (2 Questions)

Question 1 of 2:
What will this code print? x = 5 y = x x = 12 print(y)
Question 2 of 2:
Which of the following is an invalid variable name in Python?

Your lightbulb moment

✧

The key takeaway
Variables label values in memory. Assignment updates what a label points to, and `+` concatenates strings.

Make it yours

Try changing the city to your hometown and the pet to your favourite animal to see your customized band name output!

Try editing the code in the playground above in Python, JavaScript, Java, or C++, and use the step-by-step Dry-Run Table to inspect how variables mutate in memory. If you get stuck, click the 🤖 AI Doubt Solver button on your screen for instant explanations!