Topic 2
Topic 2
What is a variable?
• Backbone of any program
• Storage location
• An associated symbolic name which contains
some known or unknown quantity or
information
Variables
yourName
Variables
Juan Tu
Variables and Constants are objects that a
program manipulates. Variable is a name of the
memory location, which stores a value.
Age=5
Age=5
It identifies a variable named age, which
stores data. Variables are used to hold
values. The equal sign (=) represents an
assignment statement and its effect is to
store the value 5 in the memory location,
which goes by the named age.
Variable Assignment
>>> score=85
>>>print(score)
Variable Assignment
>>> score=85
>>>print(score)
planet=“Earth”
Planet=“Saturn”
>>>print(planet,Planet)
Earth Saturn
Exercise
Create a variable named carname and assign the
value Volvo to it.