0% found this document useful (0 votes)
2 views

Python Notes by Ankush-Chap04-Variables

This document is a tutorial on variables in Python, explaining what a variable is and how to use it. It includes examples of variable assignments and highlights the rules for naming variables. The tutorial emphasizes the importance of using valid names and avoiding reserved keywords.

Uploaded by

paidpdfnotes
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python Notes by Ankush-Chap04-Variables

This document is a tutorial on variables in Python, explaining what a variable is and how to use it. It includes examples of variable assignments and highlights the rules for naming variables. The tutorial emphasizes the importance of using valid names and avoiding reserved keywords.

Uploaded by

paidpdfnotes
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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

You might also like