PYTHON TUTORIAL FOR BEGINNERS
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
Variable Naming Rules
1. Must start with a letter or an underscore ( _ ).
2. Can contain letters, numbers, and underscores.
3. Case-sensitive (my_name and my_Name are different).
4. Cannot be a reserved keyword (like for, if, while, etc.).
_my_name =
"Madhav" ⬛ for =
26 +
‘for’ is a reserved word in flython
Python Tutorial Playlist:
P y thon No te s by Ankush