← Back to Blog

Text is Data Too

The problem...

You know how to label values. But not all values are numbers.

But most real programs don't just deal with numbers.

They deal with names, messages, words. Text.

And text needs its own type.

The idea!

In Python, text is stored as a str — short for string.

A string is just a sequence of characters wrapped in quotes.

Making it real

Think of it like this: every letter, space, or symbol between quotes is part of the string.

Python treats the whole thing as one value.

In practice

name = "Bull"
message = "Hello, world!"
empty = ""

What happens?

  • name stores a single word
  • message stores a full sentence
  • empty is a valid string — just with nothing in it

Single or double quotes?

Both work.

name = "Bull"
name = 'Bull'

Same result. Pick one and stay consistent.

Double quotes are more common. Start there.

Why this matters?

Without strings, you can't work with text. And most programs deal with text constantly.

  • usernames
  • messages
  • file names
  • error messages

All of these are strings.

Going further

first = "Red"
second = "Horn"
print(first + second)

Output → RedHorn

You can combine strings with +. This is called concatenation.

Python just joins them together. No space added unless you put one in.

What's really happening

A string is not just text. It's a value with structure.

It has length. It has positions. It has things it can do.

You'll see all of that in the next articles.

Heads up!

  • Quotes must match — open with ", close with "
  • Forgetting to close a quote breaks everything
  • "25" is not the same as 25 — one is a string, one is a number

The mindset shift

Stop thinking: "Text is just text."

Start thinking: "Text is data. And data has a type."

What you should understand now

  • Strings store text in Python
  • They use single or double quotes
  • An empty string is still a valid string
  • Strings can be combined with +
  • "25" and 25 are not the same thing
[ login to bookmark ] // copied! 50 views · 1 min
// resources
Code Example strings_basics.py
← prev Not All Values Are the Same next → Every Character Has a Number
// 0 comments
// No comments yet. Be the first.
// leave a comment

// Your comment will appear after approval.