SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Lesson 02
 
Python Keywords and
Identi ers
Perth AI School
Python Keywords and Identi ers (Variable names)
In this tutorial, you will learn about keywords (reserved words in Python) and identi ers (names given
to variables, functions, etc.).
Python Keywords
Keywords are the reserved words in Python.
We cannot use a keyword as a variable name, function name or any other identi er. They are
used to de ne the syntax and structure of the Python language.
In Python, keywords are case sensitive.
There are 33 keywords in Python 3.7. This number can vary slightly over the course of time.
All the keywords except , and are in lowercase and they must be written as
they are. The list of all the keywords is given below.
True False None
False await else import pass
None break except in raise
True class nally is return
and continue for lambda try
as def from nonlocal while
assert del global not with
async elif if or yield
Looking at all the keywords at once and trying to gure out what they mean might be
overwhelming.
Python Keywords and Identi ers (Variable names)
Python Identi ers
An identi er is a name given to entities like class, functions, variables, etc. It helps to
di erentiate one entity from another.
Rules for writing identi ers
1. Identi ers can be a combination of letters in lowercase or uppercase or
digits or an underscore . Names like , and ,
all are valid example.
(a to z) (A to Z)
(0 to 9) _ myClass var_1 print_this_to_screen
2. An identi er cannot start with a digit. is invalid, but is a valid name.1variable variable1
3. Keywords cannot be used as identi ers.
=global 1
Output
File "<interactive input>", line 1
global = 1
^
SyntaxError: invalid syntax
4. We cannot use special symbols like , , , , etc. in our identi er.! @ # $ %
a@ = 0
Output
File "<interactive input>", line 1
a@ = 0
^
SyntaxError: invalid syntax
5. An identi er can be of any length.
Things to Remember
Python is a case-sensitive language. This means, and are not the same.Variable variable
Python Keywords and Identi ers (Variable names)
Always give the identi ers a name that makes sense. While is a valid name, writing
would make more sense, and it would be easier to gure out what it represents
when you look at your code after a long gap.
c = 10
count = 10
Multiple words can be separated using an underscore, like .this_is_a_long_variable

More Related Content

PPTX
Python - Data Structures
NR Computer Learning Center
 
PDF
Python-03| Data types
Mohd Sajjad
 
PDF
Introduction to Python
Mohammed Sikander
 
PPTX
Values and Data types in python
Jothi Thilaga P
 
PPTX
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
PPTX
Programming
monishagoyal4
 
PDF
Basic Concepts in Python
Sumit Satam
 
PDF
Operators in python
eShikshak
 
Python - Data Structures
NR Computer Learning Center
 
Python-03| Data types
Mohd Sajjad
 
Introduction to Python
Mohammed Sikander
 
Values and Data types in python
Jothi Thilaga P
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
Programming
monishagoyal4
 
Basic Concepts in Python
Sumit Satam
 
Operators in python
eShikshak
 

What's hot (20)

PPTX
Python Functions
Mohammed Sikander
 
PPTX
Data Type in C Programming
Qazi Shahzad Ali
 
PPTX
Functions in python slide share
Devashish Kumar
 
PPT
Data types
myrajendra
 
PDF
Class and Objects in Java
Spotle.ai
 
PPT
RECURSION IN C
v_jk
 
PPSX
Modules and packages in python
TMARAGATHAM
 
PPTX
Variables in C++, data types in c++
Neeru Mittal
 
PPTX
Inheritance in java
RahulAnanda1
 
PPT
Abstract data types
Poojith Chowdhary
 
PPTX
Looping Statements and Control Statements in Python
PriyankaC44
 
PDF
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 
PPTX
Packages in java
Elizabeth alexander
 
PPTX
Conditional and control statement
narmadhakin
 
DOCX
Basic structure of c programming
TejaswiB4
 
PDF
Python set
Mohammed Sikander
 
PPTX
Function in C program
Nurul Zakiah Zamri Tan
 
PPT
Bitwise operators
Puneet Rajput
 
Python Functions
Mohammed Sikander
 
Data Type in C Programming
Qazi Shahzad Ali
 
Functions in python slide share
Devashish Kumar
 
Data types
myrajendra
 
Class and Objects in Java
Spotle.ai
 
RECURSION IN C
v_jk
 
Modules and packages in python
TMARAGATHAM
 
Variables in C++, data types in c++
Neeru Mittal
 
Inheritance in java
RahulAnanda1
 
Abstract data types
Poojith Chowdhary
 
Looping Statements and Control Statements in Python
PriyankaC44
 
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 
Packages in java
Elizabeth alexander
 
Conditional and control statement
narmadhakin
 
Basic structure of c programming
TejaswiB4
 
Python set
Mohammed Sikander
 
Function in C program
Nurul Zakiah Zamri Tan
 
Bitwise operators
Puneet Rajput
 
Ad

Similar to Lesson 02 python keywords and identifiers (20)

PPTX
Python Keywords and Identifiers - An Introduction
VijethaChandran
 
PPTX
Hehejutjfjdkdoeororititjtnfjdjfbtheioejj.pptx
NandhiniChennuru
 
PDF
Introducing Python keywords - Naresh IT
Naresh IT
 
PPTX
MODULE -1 Introduction to python -notes-grade 8).pptx
SUMYVINOD
 
PPTX
MODULE -1 INTRODUCTION TO PYTHON-NOTES.pptx
SUMYVINOD
 
PPTX
Python Session - 2
AnirudhaGaikwad4
 
PPTX
Jas_python.pptx for beginners introduction
JaspreetKaur410261
 
PPTX
Python Programming 1.pptx
Francis Densil Raj
 
DOCX
Python Keywords
khanmusfera32
 
PPTX
UNIT1Lesson 2.pptx
CheriviralaNikhil
 
PPTX
MODULE hdsfsf gefegsfs wfefwfwfg etegeg.pptx
prasathg214
 
PPTX
Python Programming Basics for begginners
Abishek Purushothaman
 
PDF
A485937779_22738_27_2025_UNIT-1 Lesson 2 Part 1 Variables, Expression and Sta...
KartikSharma591420
 
PDF
Python - Lecture 1
Ravi Kiran Khareedi
 
PPTX
Python Programming for problem solving.pptx
NishaM41
 
DOCX
PYTHON-Unit-I-Notes for python learnerss
Sree Saraswathi Thiagaraja College
 
PPTX
Basic concepts of python
deepalishinkar1
 
PPTX
PYTHON PROGRAMMING (2).pptx
SoundariyaSathish
 
PPT
It covers the various basics and fundamentals aspect of Python Programing
ssuserc607cd
 
PPTX
Python 01.pptx
AliMohammadAmiri
 
Python Keywords and Identifiers - An Introduction
VijethaChandran
 
Hehejutjfjdkdoeororititjtnfjdjfbtheioejj.pptx
NandhiniChennuru
 
Introducing Python keywords - Naresh IT
Naresh IT
 
MODULE -1 Introduction to python -notes-grade 8).pptx
SUMYVINOD
 
MODULE -1 INTRODUCTION TO PYTHON-NOTES.pptx
SUMYVINOD
 
Python Session - 2
AnirudhaGaikwad4
 
Jas_python.pptx for beginners introduction
JaspreetKaur410261
 
Python Programming 1.pptx
Francis Densil Raj
 
Python Keywords
khanmusfera32
 
UNIT1Lesson 2.pptx
CheriviralaNikhil
 
MODULE hdsfsf gefegsfs wfefwfwfg etegeg.pptx
prasathg214
 
Python Programming Basics for begginners
Abishek Purushothaman
 
A485937779_22738_27_2025_UNIT-1 Lesson 2 Part 1 Variables, Expression and Sta...
KartikSharma591420
 
Python - Lecture 1
Ravi Kiran Khareedi
 
Python Programming for problem solving.pptx
NishaM41
 
PYTHON-Unit-I-Notes for python learnerss
Sree Saraswathi Thiagaraja College
 
Basic concepts of python
deepalishinkar1
 
PYTHON PROGRAMMING (2).pptx
SoundariyaSathish
 
It covers the various basics and fundamentals aspect of Python Programing
ssuserc607cd
 
Python 01.pptx
AliMohammadAmiri
 
Ad

Recently uploaded (20)

DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
CDH. pptx
AneetaSharma15
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
CDH. pptx
AneetaSharma15
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 

Lesson 02 python keywords and identifiers

  • 1. Lesson 02   Python Keywords and Identi ers Perth AI School
  • 2. Python Keywords and Identi ers (Variable names) In this tutorial, you will learn about keywords (reserved words in Python) and identi ers (names given to variables, functions, etc.). Python Keywords Keywords are the reserved words in Python. We cannot use a keyword as a variable name, function name or any other identi er. They are used to de ne the syntax and structure of the Python language. In Python, keywords are case sensitive. There are 33 keywords in Python 3.7. This number can vary slightly over the course of time. All the keywords except , and are in lowercase and they must be written as they are. The list of all the keywords is given below. True False None False await else import pass None break except in raise True class nally is return and continue for lambda try as def from nonlocal while assert del global not with async elif if or yield Looking at all the keywords at once and trying to gure out what they mean might be overwhelming.
  • 3. Python Keywords and Identi ers (Variable names) Python Identi ers An identi er is a name given to entities like class, functions, variables, etc. It helps to di erentiate one entity from another. Rules for writing identi ers 1. Identi ers can be a combination of letters in lowercase or uppercase or digits or an underscore . Names like , and , all are valid example. (a to z) (A to Z) (0 to 9) _ myClass var_1 print_this_to_screen 2. An identi er cannot start with a digit. is invalid, but is a valid name.1variable variable1 3. Keywords cannot be used as identi ers. =global 1 Output File "<interactive input>", line 1 global = 1 ^ SyntaxError: invalid syntax 4. We cannot use special symbols like , , , , etc. in our identi er.! @ # $ % a@ = 0 Output File "<interactive input>", line 1 a@ = 0 ^ SyntaxError: invalid syntax 5. An identi er can be of any length. Things to Remember Python is a case-sensitive language. This means, and are not the same.Variable variable
  • 4. Python Keywords and Identi ers (Variable names) Always give the identi ers a name that makes sense. While is a valid name, writing would make more sense, and it would be easier to gure out what it represents when you look at your code after a long gap. c = 10 count = 10 Multiple words can be separated using an underscore, like .this_is_a_long_variable