Variables in programming are something like containers storing some specific things.
Variables are a way we store data on the computer.
This is how we create variables in Python:
Syntax:
variable_name = data
But, there’s a catch here, you cannot have some crazy names as variable names in Python.
There are some best practices in Python being followed by the Python community when it comes to naming your variable names.
Do’s
Variable names can contain letters, numbers, underscore
Always start with a lowercase letter or an underscore
snake_case Use lowercase letters and underscores for spaces.
Don't's
- Do not use reserved keywords of Python as variable names, because this is what Python will tell you:
... Traceback (most recent call last): File "./program.py", line (x), in <module> ...
- Do not use special characters like !,@,#,$,%,^,&,* in a variable name, because you will get the same error message:
... Traceback (most recent call last): File "./program.py", line (x), in <module> ...
Note
Keep in mind that Python is the case—sensitive, which means variables like hello and Hello are very different for Python.
Who Am I?
I’m Aswin Barath, a Software Engineering Nerd who loves building Web Applications, now sharing my knowledge through Blogging during the busy time of my freelancing work life. Here’s the link to all of my craziness categorized by platforms under one place: https://linktr.ee/AswinBarath
Join me to learn Python!
Checkout my Python Programming Series where my mission is to share my knowledge on Python: aswinbarath.hashnode.dev/series/python-prog..
Learn what I know about Python from any of my favourite knowledge sources:
Keep Learning
Now, I guess this is where I say GoodBye👋.
But, hey it’s time for you to start learning with your newfound Knowledge(Power)👨💻👩💻 .
Good Job that you made it this far 👏👏
Thank you so much for reading my Blog🙂.