Studio Matrx Monthly · Volume 1 · Issue 3 · August 2026
Amogh N P
 In loving memory of Amogh N P — Architect · Designer · Visionary 
Variables and Data TypesLesson 1.2
PSD for Architecture, Planning & Urban Design/Module 1 · Python Fundamentals

Lesson 1.2 · Python Fundamentals

Variables and Data Types

Named boxes for your values, and the four kinds of thing Python stores - the vocabulary every script is built from

12 min Interactive lessonFree · open lessonByAmogh N P· Architect & interior designer
The hook

If code is a set of instructions, variables are the nouns - the named things your instructions act on. Get these and half of Python is yours.

In the last lesson you printed values - a room area, a paint estimate. But you typed each number in by hand. The moment you want to reuse a value, change it in one place, or refer to it by a meaningful name, you need a variable: a name attached to a value.

Variables are the vocabulary of programming, and Python keeps them refreshingly simple. This lesson covers how you make one, the four kinds of value you will use constantly - whole numbers, decimals, text and true/false - and how Python quietly keeps track of which is which. Master this small vocabulary and most of what code does starts to read like plain instructions about named things.

= means 'gets', right to left. Four types: int (count), float (measure), str (text), bool (yes/no). Name your boxes.

Variables - named boxes for your values

A variable is a name that points to a value. You create one with a single = sign - the assignment operator - putting the name on the left and the value on the right:

python
ceiling_height = 2.7
room_name = "Master Bedroom"
sockets = 6

Read = not as 'equals' but as 'gets' or 'is set to': ceiling_height gets the value 2.7. From then on, wherever you write ceiling_height, Python substitutes 2.7. That is the whole point - you name a value once and reuse it by name, so your code reads in meaningful terms rather than mystery numbers.

The real power is that a variable can change, and everything using its name updates. And you can compute new variables from old ones:

python
length = 5.0
width = 4.0
area = length * width      # area is now 20.0
length = 6.0               # change one input...
area = length * width      # ...recompute; area is now 24.0
print(area)                # 24.0

Think of a variable as a labelled box: the label is the name, the contents are the value, and you can swap the contents whenever you like. Naming your values - area, rate, sockets - instead of scattering raw numbers through your code is the difference between a script you can read next month and one you cannot. This tiny idea, a name pointing at a value, is the foundation everything else stands on.

One pattern you will meet constantly is a variable that updates itself. Because = means 'compute the right side, then store it under the left name', a line like count = count + 1 is perfectly sensible: take the current count, add one, and put the result back in the same box. Python even has a shorthand for it, count += 1, which does exactly the same thing - and -=, *= and /= work the same way. You will see these everywhere once loops arrive, where a running total or a counter grows step by step; meeting the idea now, on a single line, means it will not surprise you later.

A VARIABLE IS A NAME FOR A VALUEceiling_htthe name (a label)=2.7the value (stored in memory)ceiling_ht = 2.7Read it right to left: put the value 2.7 into a box, thenstick the label ceiling_ht on it. Say the name, get the value.
Zoom
A variable is a name attached to a value. The assignment `ceiling_ht = 2.7` stores the value 2.7 in memory and labels it ceiling_ht. Read it right to left - compute the value, then attach the name - and from then on saying the name gives you the value.

The four core data types

Every value in Python has a type - what kind of thing it is - and the type decides what you can do with it. Four types cover the vast majority of everyday scripting.

`int` is an integer: a whole number, positive or negative, with no decimal point - 3, -5, 240. Use it for things you count: sockets, floors, tiles, people.

`float` is a floating-point number: a number with a decimal point - 2.7, 0.5, 18.0. Use it for things you measure: lengths, areas, rates, money. Note that 18 is an int but 18.0 is a float; the decimal point is what tells them apart.

`str` is a string: text, written inside quotes - "oak", "Room 4", "2.7m". Single or double quotes both work ('oak' equals "oak"); pick one and be consistent. Anything in quotes is text, even "12" - which looks like a number but is not one, a distinction the next lesson leans on hard.

`bool` is a Boolean: one of exactly two values, True or False (capitalised, no quotes). Booleans are how code answers yes/no questions - is this room bigger than 15 sqm? - and they power every decision your programs make in Module 2.

python
floors = 3            # int
slab_thickness = 0.15 # float
material = "concrete" # str
is_load_bearing = True # bool

These four - count, measure, text, yes/no - are the raw materials. Almost every value you handle for a long while is one of them.

One more you should recognise even though you will rarely type it: `None`. It is Python's word for 'nothing here yet' - a deliberate empty value, distinct from 0 or an empty string. You will meet it when a value has not been set or a lookup finds nothing, and knowing the name saves confusion later. Types also mix in sensible ways: combine an int and a float in arithmetic and Python quietly promotes the result to a float (3 * 2.5 is 7.5), because a float can hold everything an int can. What it will not do is silently mix text and numbers - that boundary is real and deliberate, and the next lesson is largely about crossing it safely.

THE FOUR CORE TYPESintwhole numbers3-5240floatdecimals2.70.518.0strtext"oak""Room 4""2.7m"booltrue or falseTrueFalseEvery value has a type. The type decides what you can do with it. Check it with type(value).
Zoom
The four core data types you will use constantly: int for whole numbers you count, float for decimal numbers you measure, str for text in quotes, and bool for the two truth values True and False. Every value has a type, and the type decides what you can do with it - check any value with type().

Checking a type with type()

When you are unsure what kind of value you are holding - and you often will be, especially with data that comes from a file - Python tells you. The built-in `type()` function reports a value's type:

python
print(type(3))        # <class 'int'>
print(type(2.7))      # <class 'float'>
print(type("oak"))    # <class 'str'>
print(type(True))     # <class 'bool'>

That <class 'int'> is just Python's way of saying 'this is an int'. You can call type() on a variable too, which is a genuinely useful habit when a script misbehaves:

python
tile_count = "48"
print(type(tile_count))   # <class 'str'>  -- aha, that is text, not a number

This one line explains a huge share of beginner confusion. A value that looks like a number - "48" - can secretly be a string, and Python will refuse to do arithmetic on it or will do something surprising (as you will see, "48" * 2 gives "4848", not 96). When code does not behave, print(type(x)) is often the fastest way to see why: you were treating text as a number, or a float as an int. Reaching for type() to check your assumptions is a small diagnostic move that will save you real time throughout the course.

Dynamic typing - Python figures it out

Here is something Python does that many languages do not: you never declare a type. You do not tell Python 'this variable will hold an integer'. You just assign a value, and Python infers the type from what you gave it. This is called dynamic typing, and it is a big part of why Python feels light to write:

python
x = 5          # x is an int now
x = 5.0        # x is a float now
x = "five"     # x is a str now
x = True       # x is a bool now

The same name happily holds different types at different times, because the value carries the type, not the name. Compare this to more ceremonious languages where you would write the type explicitly every time - Python spares you that, so you can move fast.

That freedom has a flip side worth naming early. Because nothing stops you reassigning a variable to a totally different kind of thing, a slip - accidentally overwriting a number with text, say - will not be caught until the code runs and misbehaves. Python trusts you. In practice this is rarely a problem for the small scripts you will write, and the fix is simple discipline: give variables clear names, keep each one holding one kind of thing, and reach for type() when something surprises you. Dynamic typing is a convenience you will come to appreciate; just stay aware that you are the one keeping track of what each box holds.

Naming variables so future-you can read them

Python is relaxed about types but has firm, simple rules for names. A variable name can use letters, digits and underscores; it must not start with a digit; and it cannot contain spaces or most punctuation. room_area is fine; 2nd_floor, room area and room-area are not. Names are also case-sensitive: Area and area are two different variables, a subtle source of bugs, so stay consistent.

Beyond the rules is a strong convention. Python code overwhelmingly uses snake_case - lowercase words joined by underscores - for variable names: ceiling_height, tile_count, is_load_bearing. Following it makes your code look like everyone else's, which matters more than it sounds when you read examples or ask an AI assistant for help.

The deeper point is that names are documentation. Compare these two lines that do the identical calculation:

python
c = a * b * 1.08                       # what on earth is this?
tile_cost = area * rate * waste_factor # oh, a tile cost with waste

Both run. Only one tells you what it means six weeks later. Good names turn code into something close to readable prose - the whole reason Python is a good first language. Spend the extra two seconds to write wall_area instead of w; it is the cheapest, highest-return habit in programming, and the reader you are helping is usually yourself.

Two small cautions round this out. A handful of words are reserved by the language itself - if, for, True, class, import and a few dozen others - and you cannot use them as variable names; if a name lights up as a keyword in your editor, pick another. And avoid quietly overwriting the names of built-in tools: naming a variable list, str, type or sum works, but it shadows the function of the same name so you can no longer call it. When you want a value to signal 'this must not change' - a fixed rate, a conversion constant - the convention is to name it in ALL_CAPS, like SQM_PER_LITRE = 10. Python will not stop you changing it, but the capitals tell every reader you did not intend to.

Concepts & functions in this lesson

variable

A name that points to a value in memory

Created with `=`; reusable and reassignable. The nouns your instructions act on.

int / float

Whole numbers vs numbers with a decimal point

Count with int, measure with float. 18 is an int; 18.0 is a float.

str

Text, written inside single or double quotes

Anything in quotes is a string - even "12", which is not the number 12.

bool

The two truth values True and False

Capitalised, no quotes. The answer to every yes/no question; powers decisions in Module 2.

type()

A built-in that reports a value's type

print(type(x)) is your fastest check when a script treats text as a number or vice versa.

Hands-on workshop

Workshop - a named-variable room calculator

Build a small script whose inputs are all named variables, then prove you understand the types by inspecting them. The aim is fluency with assignment and the four core types on real design numbers.

Python 3 and an editor (VS Code). No libraries or design software needed.

Given & goal
Goal: model one room with named variables and check every type
Inputs: dimensions and finishes from a real (or imagined) room
Time: ~25 minutes
  1. 1In a file room.py, create named variables for one room: length and width as floats, sockets as an int, room_name as a str, and is_wet_area as a bool.
  2. 2Compute area = length * width and print() the room name and its area on one line, with a short label.
  3. 3Add a line print(type(length), type(sockets), type(room_name), type(is_wet_area)) and run it. Confirm each reports the type you intended.
  4. 4Deliberately break it: set length = "5" (with quotes), rerun, and see how area changes or errors. Note in a comment what happened and why, then fix it back to a float.
  5. 5Rename one variable from a single letter to a descriptive snake_case name and confirm the script still runs - proving names are for humans, not Python.

You’ll walk away with
A `room.py` that models one room with well-named variables of all four types, prints its area, and prints each value's type - plus a one-line comment recording what happened when you made a number into a string.

The worked example

Three altitudes on the same idea

Read the band that fits you — or all three.

For the architectAutomate busywork & build custom tools

Named variables turn a one-off calculation into a reusable model of a decision. Write a massing or cost estimate with floor_area, far, rate as named inputs, and changing one assumption becomes a one-line edit rather than a hunt through scattered numbers. This habit - name your inputs, compute from them - is the seed of every parametric study you will build in later modules.

For the interior designerScripts for data, schedules & layouts

Most interiors numbers are floats and strings: measured areas, unit rates, finish and material names. Getting comfortable with the int/float/str distinction now prevents the classic snag where a quantity read from a spreadsheet is secretly text and will not add up. Naming values clearly - sofa_price, curtain_length - makes a schedule script something you can reread and trust.

For the studentA hireable computational skill

This small vocabulary - variable, int, float, str, bool - is the grammar every other course in the Academy assumes. Nail it and the pandas, geometry and Grasshopper modules stop feeling foreign. Practise reading code aloud in these terms ('area gets length times width'); once assignment and types are second nature, the harder material is mostly recombination of what you already know.

Misconception check

The single `=` in `area = length * width` means the two sides are equal, like in maths.

This trips up almost everyone from a maths background, and it matters because it makes some perfectly normal code look nonsensical. In Python, = is not a statement of equality - it is an instruction: 'compute the value on the right, then attach the name on the left to it.' That is why a line like count = count + 1 is not a contradiction (a number cannot equal itself plus one); it means 'take the current count, add one, and store the result back under the same name.' Read = as 'gets' or 'is set to', always right-to-left. When you actually want to ask whether two things are equal - a yes/no question - you use two equals signs, ==, which is a different operator entirely and the subject of the next lesson.
Try it

Do it yourself

Predict the answer first, then run it to check.

  1. 1What does = actually do in price = 1450? Say it in words.
  2. 2Which type is each: 12, 12.0, "12", True? Confirm with type().
  3. 3Write three named variables describing a door (a width, a material, and whether it is fire-rated) with sensible types.
  4. 4After x = 5 then x = "five", what type is x? Why is Python happy to let you do that?
  5. 5Why is tile_cost a better variable name than t, when both run identically?
Take this with you

The one line to carry out

A variable is a name attached to a value, made with `=` (read it as 'gets'); every value has one of four everyday types - int, float, str, bool - and Python tracks the type for you, so your job is clear names and knowing which kind of thing each box holds.
Take it further
References & further reading

Peer-reviewed journals & authoritative standards

  1. 01Variable (computer science)Wikipedia, 2026.
  2. 02Data typeWikipedia, 2026.
  3. 03The Python TutorialPython 3 documentation, 2026.
  4. 04Boolean data typeWikipedia, 2026.
Related lessons
Recap
Variables are named boxes: name = value stores a value under a name you can reuse and reassign, and read = as 'gets', right to left. Every value has a type - int (whole numbers), float (decimals), str (text in quotes), bool (True/False) - which decides what you can do with it, and type(x) reports it. Python is dynamically typed, so you never declare types; that keeps code light, but means you keep track of what each variable holds, helped by clear snake_case names.
Carry forward →

You can name and store the four kinds of value. Next we put them to work - the arithmetic, string-building and comparison operators that turn stored values into results, and how to convert between text and numbers.

A

The author

Amogh N P

Architect, interior designer, and creative polymath. Studio Matrx began in his notebooks — his vision of design made honest, useful, and open to everyone. Its Academy is written and taught in his memory, and free, forever.

More about Amogh →