Python Coding Series:
Episode 3: Variables
Hi guys, Welcome back to Series and today we will see what is Variables in Python. So stay tuned to learn about it.
What are Python Variables?
Python has several variables, i.e, You can have anything you want for example a,b,c.
These Variables are something that we use to define or assign our values to it.
Eg: A = "Hello, World!"
These values when printed shows the assigned value and not themselves.
Eg: A = "Hello, World!"
print(A)
This syntax will print A's assigned value and not A because we didn't have an apostrophe There.
These Variables are used to allocate memory for the values assigned to them. The computer saves some memory so it could be executed whenever needed or later on in the program.
There are some rules to be followed while creating a variable:
- Variables can only start with a letter or an Underscore.
- A number cannot be called a variable. We cannot start a variable with a Number but can have numbers in the middle or the end.
- A variable name should only contain Alpha-numeric Characters and Underscores.
- Variable names are Case-Sensitive. Eg: Variable, variable and VARIABLE are three kinds of Variable names. This Case-sensitive Rule can be helpful as it gives a lot of names to choose from.
- The keywords such as 'if, int, str, float, else(These will be taught later on an episode) etc. cannot be used in naming a variable.
0 Comments