A variable is a named memory location in which we can store values for the particular program.In other words, Variable is a name which is used to refer memory location. Variable also known as identifier and used to hold value.
In Python, We don't need to declare explicitly variable in Python. When we assign any value to the variable that variable is declared automatically.
In Python, We don't need to specify the type of variable because Python is a loosely typed language. I.e. In loosely typed language no need to specify the type of variable because the variable automatically changes it's datatype based on assigned value.
For Example:
a=10 Where variable a is an integer datatype.
b="Glance" Where variable b is string datatype.
Rules for naming variable:
a=10 #integer
b="StudyGlance" #string
c=12.5 #float
print(a)
print(b)
print(c)
10
StudyGlance
12.5
Python allows us to assign a value to multiple variables and multiple values to multiple variables in a single statement which is also known as multiple assignment.
x=y=z=50
print x
print y
print z
50
50
50
a,b,c=5,10,15
print a
print b
print c
5
10
15