In this article, we’ll learn about various brackets in Python, what are they, and how to use them using examples
if you missed out on the previous articles in this series, you can check them out here:
What are these {}, (), [] in Python?
Brackets in the short form are called braces
{} – Flower braces
() – Braces
[] – Square braces
How do we use them?
Mainly used in two situations: 1. Storing the Data, 2. Modifying the Data
- Storing the data: Lists use [], Tuples use (), Dictionaries & Sets use {}
- Modifying the data: Functions use (), Parameters use {}, Dataframes use []
Wait? what are these Lists, Tuples, Dict.., Sets, Functions, and Dataframes?? Let’s not worry too much, because we’ll be covering each of these topics one by one in depth in our upcoming articles.
Examples:
Without worrying too much about the code, let’s take a few examples:
Note: Please open colab and try these examples, otherwise you’ll not be able to remember any of these.
Note: ‘#’ – these lines are called comments, they are just used for explanation
I would highly encourage you to try various examples of your choice and get a feel for yourself so that you are able to understand things better.
Congrats! You have just learned about brackets in Python
If you want to get the latest updates on my website about new posts, join the Telegram channel here
[post-views]