In programming, a "variable" is a container in which a data value can be stored within the computer’s memory. The stored value can then be referenced using the variable’s name. Data to be stored in a variable is assigned in a Python program declaration statement with the = assignment operator.
Syntax:
variable_name = variable_value;
Example:
a = 10;
name = "Joes";
In the example, x is a variable that holds the value 10, and name is a variable that holds the string value "Joes". The data type of the value assigned to a variable is dynamically inferred by Python, so you don't need to explicitly specify the type of a variable.
Once a variable is created, its value can be accessed and changed later in the program. The value of a variable can be changed by reassigning a new value to it:
a = 20;
In this example, the value of x is changed from 10 to 20.
Here are some rules for creating and using variables in Python:
name= "Ram"
User_name= "Ram"
name2= "Ram"
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions