Python Identifier and Keywords



Keywords are the reserved words in Python. We cannot use a keyword as 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.3. This number can vary slightly in course of time. All the keywords except True, False and None are in lowercase and they must be written as it is. The list of all the keywords are given below.

Keywords in Python programming language
False class finally is return
None continue for lambda try
True def from nonlocal while
and del global not with
as elif if or yield
assert else import pass
break except in raise

Looking at all the keywords at once and trying to figure out what they mean might be overwhelming. But if you want to have an overview, here is the complete list of all the keywords with examples.


Identifier is the name given to entities like class, functions, variables etc. in Python. It helps differentiating one entity from another.

Rules for writing identifiers in Python

  1. 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.
  2. An identifier cannot start with a digit. 1variable is invalid, but variable1 is perfectly fine.
  3. Keywords cannot be used as identifiers.
    >>> global = 1
      File "<interactive input>", line 1
        global = 1
    SyntaxError: invalid syntax
  4. We cannot use special symbols like !, @, #, $, % etc. in our identifier.
    >>> a@ = 0
      File "<interactive input>", line 1
        a@ = 0
    SyntaxError: invalid syntax


  5. Identifier can be of any length.

    Things to care about

    Python is a case-sensitive language. This means, Variable and variable are not the same. Always name identifiers that make sense. While, c = 10 is valid. Writing count = 10 would make more sense and it would be easier to figure out what it does even when you look at your code after a long gap. Multiple words can be separated using an underscore, this_is_a_long_variable. We can also use camel-case style of writing, i.e., capitalize every first letter of the word except the initial word without any spaces. For example: camelCaseExample

Previous article
Next article

Leave a reply

Please enter your comment!
Please enter your name here

Share post:



More like this

Tango Live: Free Guide to Exclusive Features and Benefits

Introduction Welcome to our comprehensive guide on Tango Live, the...

How to Setup SailPoint and Manage IdentityIQ with Compass

Introduction to SailPoint Technology and SailPoint Compass: A Comprehensive...

XXVI Video Player – Exclusive Multimedia Companion

Introduction to XXVI Video Player Download XXVI Video Player, Link...

How to Use Telegram Web Login for Windows and Mac

Telegram Web Login: A Comprehensive How to Guide Telegram is...