KEMBAR78
Python Notes by Rishabh Mishra-Chap04-Variables | PDF
0% found this document useful (0 votes)
8 views2 pages

Python Notes by Rishabh Mishra-Chap04-Variables

This document is a tutorial on variables in Python, explaining that a variable is a symbolic name referencing an object and can hold different data values. It provides examples of variable assignments and naming conventions, including rules such as starting with a letter or underscore and being case-sensitive. Additionally, it highlights the importance of not using reserved keywords for variable names.

Uploaded by

akrajcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Python Notes by Rishabh Mishra-Chap04-Variables

This document is a tutorial on variables in Python, explaining that a variable is a symbolic name referencing an object and can hold different data values. It provides examples of variable assignments and naming conventions, including rules such as starting with a letter or underscore and being case-sensitive. Additionally, it highlights the importance of not using reserved keywords for variable names.

Uploaded by

akrajcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON TUTORIAL FOR BEGINNERS

Source: www.youtube.com/@RishabhMishraOfficial

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.
PythonLevel = "Beginner" # pascal case
pythonLevel = "Beginner" # camel case
pythonlevel = "Beginner" # flat case
python_level = "Beginner" # Snake case

P y t h o n N o t e s b y R i s h a b h M i s h ra
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 Python

Python Tutorial Playlist: Click Here


https://www.youtube.com/playlist?list=PLdOKnrf8EcP384Ilxra4UlK9BDJGwawg9

P y t h o n N o t e s b y R i s h a b h M i s h ra

You might also like