Variables are simply defined as the storage containers in python which allows programmers to store and manipulate data presnt in them. Discover different data types, naming conventions of using variables in Python.
As we know one of the resilient features of python is it’s dynamically types which means users are not needed to statically declare the type(datatype) of the variable because python interpreter is capable of assigning data type based on the literal(value) we assigned to it.
Varibles are also known as Identifiers because they are used to identify location and values in programming langauge.
Naming Convention of Variables
Naming Conventions are simply defined as the set of rules that need to be followed during decalration of variables. They are….
- Identifiers in python must start character(a-z,A-Z) or an Underscore ( _ ).
- No Special Characters are allowed in the name of identifiers in python.
- The underscores and digits are allowed from the second characters of identifier in python.
Examples of some valid Identifier Names
- var
- _my_var
- var1
- var_1
- First_Var
Assigning values to variables in python
The values to vatribles in python can be assigned without explicitly mentioning data type. The data type of the variable can be checked using type() fucntion in python as follows……
Output
Stay tuned to http://codewithcurious.com for python related blogs….🙂