Python Notes by Ankush-Chap04-Variables
Python Notes by Ankush-Chap04-Variables
Chapter - 04
Variables in Python
What is a Variable
Variables - examples
Variable Naming Rules
Variables in Python
A variable in Python is a symbolic name that is a reference or pointer
to an object.
In simple terms, variables are like containers that you can fill in with
different types of data values. Once a variable is assigned a value,
you can use that variable in place of the value.
We assign value to a variable using the assignment operator (=).
Syntax: variable_name =
value Example: greeting =
"Hello World"
print(greeting)
Variable Examples
Python can be used as a powerful calculator for performing a wide
range of arithmetic operations.
flythonLev = "Beginner pascal
el " case
pythonLev = "Beginner camel
el " case
pythonlev = "Beginner flat
el " case
python_lev = "Beginner Snake
P y thon No te s by Ankush
el " case
P y thon No te s by Ankush
x = 10
print(x+1) add number to a variable
a, b, c = 1, 2, 3
print(a, b, c) assign multiple variables
_my_name =
"Madhav" ⬛ for =
26 +
‘for’ is a reserved word in flython
P y thon No te s by Ankush