All the Little Symbols in Python (and Why They’re There)
If you’ve ever looked at Python code and thought, "What’s with all these symbols?" you’re not alone. Parentheses, brackets, curly braces, colons—there’s a whole cast of characters in even the simplest scripts. And if no one ever explicitly explained them to you, they can feel like some kind of secret code.
But here’s the thing: they all have a reason for being there. Once you know what they do, Python becomes a lot easier to read (and write). In this week's Cameron's Corner, I will walk you through the most common symbols in beginner Python code, breaking down what they are and why they matter.
Teaching & The Curse of Knowledge
Let’s start with a deep truth about learning Python: starting from scratch is hard.
Many trainings/tutorials, even the friendliest ones, are often written by people who have been coding so long they don’t even see the little symbols they’re using. They just type away—parentheses here, brackets there, curly braces and colons—and you’re left wondering:
"What are these things? Why are they here? Did I miss the day everyone was taught how to use them?"
You didn’t miss anything. You’re not alone. It’s not obvious.
This post is for you if you are the absolute beginner, the "I-have-never-written-code-before" person. You'll also find value in this post if you're familiar with Python but don't understand the why behind the basics. We're going to name and explain every symbol you’ll see in beginner Python code so you can stop feeling like it’s all magic.
All the Symbols You’ll See in Python
Here are the symbols that show up over and over again in Python:
Symbol |
Name |
---|---|
( ) |
Parentheses |
[ ] |
Square brackets |
{ } |
Curly braces (Brackets) |
: |
Colon |
, |
Comma |
' ' |
Single quotes |
" " |
Double quotes |
= |
Equals sign |
If it feels like a lot, don’t worry! Let’s look at when and why you’ll see them.
When You’ll See These Symbols
When You’re Creating Something (Containers & Strings)...
...you’ll see parentheses (…), square brackets […], curly braces {…}, single/double quotes '…'/"…", commas , and even colons :!
Sometimes you just need to make a thing—whether that's a list of items, a pair of values, or a string of text. Here’s how different symbols come into play:
my_tuple = ('a', 'b', 'c') # tuple → parentheses & commas
my_list = ['a', 'b', 'c'] # list → square brackets & commas
my_set = {'a', 'b', 'c'} # set → curly braces & commas
my_dict = {'a': 1, 'b': 2, 'c': 3} # dict → curly braces & commas & colons!
my_string = 'Hello' # string → quotes (either double quotes or single quotes)
We even have a special string that uses both quotes and curly braces, f-strings, which can be used to substitute variables that you have into strings like so:
name = 'Alice'
f'Hello, {name}!' # f-string, create a new string and substitute variables
'Hello, Alice!'
When You’re Working With Something (Indexing, Slicing, and Look-ups)...
...you'll always see square brackets […], sometimes colons : (for slicing), and sometimes single quotes '' or double quotes "" (dictionary lookups, if the keys are strings).
Once you have a container like a list, tuple, string, or dictionary, you may want to pull something out or grab part of it.
my_list = ['a', 'b', 'c', 'd']
my_list[0] # indexing: retrieve one item → 'a'
my_list[1:3] # slicing: retrieve multiple items → ['b', 'c']
my_dict = {'a': 1, 'b': 2, 'c': 3}
my_dict['b'] # look-up: retrieve one value from a dictionary, given its key → 2
# dictionaries do not support the slicing syntax unless a slice object is a key (Python 3.12)
2
You should also note that tuples and strings also support the indexing/slicing syntax, just like the list.
my_str = 'abcd'
my_str[0] # indexing: retrieve one item → 'a'
my_str[:2] # slicing: retrieve multiple items → 'ab'
my_tuple = ('a', 'b', 'c', 'd')
my_tuple[1] # indexing: retrieve one item → 'b'
my_tuple[1:] # slicing: retrieve multiple items → ('b', 'c', 'd')
('b', 'c', 'd')
When You’re Using a Function (Calling Functions)...
...you’ll see parentheses (…) and commas ,.
Functions are like little machines that do something for you- if you've manipulated a spreadsheet in Excel then you’ve likely encountered this concept within its formulas. And just like you use Excel, in Python you use parentheses when you ask a function to do its job.
sum # the sum function
<function sum(iterable, /, start=0)>
sum([1, 2, 3]) # asking the sum function to do its job
# adds up 1 + 2 + 3
6
sorted # the sorted function
<function sorted(iterable, /, *, key=None, reverse=False)>
sorted([3, 1, 2, 5]) # asking the sorted function to do its job
[1, 2, 3, 5]
# asking the sorted function to do its job with an additional option
sorted([3, 1, 2, 5], reverse=True)
[5, 3, 2, 1]
Wrap-Up
You’re not alone, and it will click!
If all these symbols feel overwhelming, that’s okay. They’re like street signs in a new city. At first, you notice every single one. But soon, you’ll just know when to use them.
So next time you see something like this:
print({'a': [1, 2, 3]})
{'a': [1, 2, 3]}
You’ll say:
"Ah, yes! print is a function (parentheses), that's a dictionary (curly braces), and inside it has one key/value pair who has a string 'a' as the key and a list (square brackets) as its value."
And that's the first step in coding—learning to read these symbols like a second language. The second step is figuring out how to assemble these symbols in a meaningful way that accomplishes a task.
You got this!
Want to learn more about Python or ask your questions directly? Join the DUTC Discord server and chat with experts and network with other Python users.