python Variables

Variables are considered to be identifiers having a physical memory location,Which  are  used to hold values temporarily during the program execution. python interpreter can determine on itself that what type of data is stored in the variable,so before assigning a value,variables do not need to ne declared.

We use the equal to sign ‘=’ to assign values to a varaiable.it assgin the values of the right side operand to the left side operand that is the variable.firstly,the variables should have a meaningful name should be maintained and the names should ne consistent.    example:

An example of a variable in python is a representational name that serves as a pointer to an object.Once an object is assigned to a variable,it can be referred to by that name.in layman’s terms,we say that variable in python is containers that stores values.

#An interger assignment
age = 45
# A floating point
salary = 1456.8
# A string
name = "John"
print(age)
print(salary)
print(name)

output:
45
1456.8
John

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top