Variables:-

A variable is a location in memory used to store some data.In Python, We don’t need to declare a variable before using it. We simply assign a value to a variable and it will exist. We don’t even have to declare the type of the variable. This is handled internally according to the type of value we assign to the variable.The equal sign (=) is used to assign values to variables.
As:-

name = "Myprogworld"
num1 = 100
num2 = 5.4

print (name)
print(num1)
print (num2)

This will produce following result:-

Myprogworld
100
5.4

Multiple Assignment:-
Python allows multiple assignment in a single statement as follows:-

a,b,c=1,2,3

result:-
multiple variablesIf we want to assign the same value to multiple variables at once, we can do this as:-

a=b=c = 1

Leave a comment