Try PRO for FREE
Python Keywords and Identifiers
In this tutorial, you will learn about keywords (reserved words in Python) and identifiers (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 identifier. They are used to define 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 True, False and None are in lowercase and they must be written as they are. The list of all the keywords is given below.
FalseawaitelseimportpassNonebreakexceptinraiseTrueclassfinallyisreturnandcontinueforlambdatryasdeffromnonlocalwhileassertdelglobalnotwithasyncelififoryield
Looking at all the keywords at once and trying to figure out what they mean might be overwhelming.
If you want to have an overview, here is the complete list of all the keywords with examples.
Python Identifiers
An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another.
Rules for writing identifiers
Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like myClass, var_1 and print_this_to_screen, all are valid example.
An identifier cannot start with a digit. 1variable is invalid, but variable1 is a valid name.
Keywords cannot be used as identifiers.global = 1Output File "
We cannot use special symbols like !, @, #, $, % etc. in our identifier.a@ = 0
Output File "
An identifier can be of any length.
Things to Remember
Python is a case-sensitive language. This means, Variable and variable are not the same.
Always give the identifiers a name that makes sense. While c = 10 is a valid name, writing count = 10 would make more sense, and it would be easier to figure out what it represents when you look at your code after a long gap.
Multiple words can be separated using an underscore, like this_is_a_long_variable.
Previous Tutorial:
Getting Started
Next Tutorial:
Statements & Comments
Share on:
Did you find this article helpful?
Related Tutorials
Python Library
Python String isidentifier()
Python Tutorial
List of Keywords in Python
Python Tutorial
Python Global, Local and Nonlocal variables
Python Tutorial
Python Functions
Join our newsletter for the latest updates.
Join
Tutorials
Python 3 Tutorial
JavaScript Tutorial
SQL Tutorial
C Tutorial
Java Tutorial
Kotlin Tutorial
C++ Tutorial
Swift Tutorial
C# Tutorial
Go Tutorial
DSA Tutorial
Examples
Python Examples
JavaScript Examples
C Examples
Java Examples
Kotlin Examples
C++ Examples
Company
About
Advertising
Privacy Policy
Terms & Conditions
Contact
Blog
Youtube
Apps
Learn Python
Learn C Programming
Learn Java



© Parewa Labs Pvt. Ltd. All rights reserved.