× Python Introduction What is Python Python Features Python History Python Applications Python Install Python Path Python Example Execute Python Keywords Constant Variable Statements & Comments Python I/O and Import Operators UnaryBinaryTernary Unary Operators Unary Minus Binary Operators Arithmetic Operators Assignment Operators Relational Operators Logicaloperators Bitwise Operator Ternary Operators Control Statements in Python conditonal Statements IF if else Else If Nested if Switch For loop Nested For Loop While Loop Nested while Loop Unconditonal Statemets Continue Break Pass FUNCTIONS Python Function Function Argument Python Recursion Anonymous Function Python Modules NATIVE DATATYPES Python List Python Numbers Python Tuple Python String Python Set Python Dictionary OOPS PRINCIPALS Encapsulation Class Variable Method Object Or Instance CreationMethod Calling OOPS Syntax And Explanation DATA ABSTRACTION Constructor Inheritance 1.Single or simple Inheritance 2.Multilevel Inheritance 3.Hierarchical Inheritance 4.Multiple Inheritance 5.Hybrid Inheritance Operator Overloading File Operation Python Directory Python Exception Python - Multithreading Python - Database Access Python - CGI Python - Reg Exp Python - Date Python - XML Processing Python - GUI
  • iconPython Online Training In Andhra Pradesh and Telangana
  • icon9010519704

Opening Hours :7AM to 9PM

Python Variable


Variable:
Variable is an identifier whose value can be changed. or which store the data
Example:
x=10;
x=20;
Varaible declaration rules:
1.Variable name must be starts with alphabet or underscore .
Example:
age=10;
_age=20;

2.The max length of the variable name is upto infinity characters.
3.If variable name contains morethan one word ,the second word onwords first letter should be
uppercase letter.
Example:
studentAge=10;
studentAgeDetails=10;
4.No spaces are allowed at the middle of the variable declaration.
Example:
student Age=10; (Invalid);
5.If variable value contains constant value that variable name must be
uppercase letter.
Example:
PI=3.14;
6.If constant variable name contains morethan one word ,it should be separated with underscore.
Example:
PI_VALUE=3.14;
7.All keywords are lower case letters. except True False None
Example:
if
for
while
8.We should not take keyword as a variable name.
Example:
if=10;(Invalid) Here if is a keyword
If=10;(Valid)

Variable Defination types:
1.Initilization
2.Declaration
3.Assignment

Initilization:
It Means initilize the some value to the variable.
Example:
x=10;
Here 10 is initilize to the x.

Declaration:
In the declaration no value initilize to the variable.
Example:
x=10;

Assignment:
In the assignment assign the value to the variable or assign variable to the variable.
Example:
x=10;(It is a value to variable).

y=x;(It is a variable to variable).