What is Variable
Variable reserved memory location to store value
The Python interpreter allocates memory and decides how much memory reserved based on the data types
Data types can be store as Integers, decimals or characters
Assigning values to variables
Python automatically declare data type when a value is assign to the variable.
The equal sign ( = ) is used to assign value to variables.
Left operator is the name of variable and Right Operator is the value stored in the variable
StudentMark = 98 # An integer type
StudentCgpa = 9.90 # float type
StudentName = “John Doe” # String type
# Now Print value
print(StudentMark) #Output 98
print(StudentCgpa) #Output 9.90
print(StudentName) #Output John Doe
a = b = c = 5
print(a) #Output: 5
print(b) #Output : 5
print(c) #Output: 5
as well as you can assign multiple object to multiple variables.
a, b, c = 1, 2.0, “John Doe”
print( a, b, c) # Output: 1 2.0 John Deo
Prev: Print Function , Indentation, Comment
Next: Data type in Python