A variable is an identifier that can change the stored value during the execution of the program.
hello = 'hi'
hello2 = hello
Rules for creating variables in Python
Variable names must start with a letter or underscore.
Variable names cannot start with a number.
A variable name can only contain letters, numbers, and underscores (A - z, 0-9, and _).
Variable names are case sensitive (num, Num and NUM are three different variables).
Reserved words (keywords) cannot be used to name a variable.
number = 10 # variable number of integer type assigns the value 10
pi = 3.14 # floating point pi is assigned the value 3.14
word = "Hello" # variable word of string type assigns the value "Hello"
print(number, pi, word)
Variable can change the value in a program.
word = "Astana"
print("2017 - ", word)
print("2018 –", word)
word = "Nur-Sultan"
print("2019 –", word)