DS301222 Q) What is Token in Python?

Ans:) A Token is the smallest individual unit in a python program . All statements and instructions in a program are built with tokens.
The various tokens in python are :

  1. Keywords: Keywords are words that have some special meaning or significance in a programming language.In Python we have 33 keywords some of them are: try, False, True, class, break, continue, and, as, assert, while, for, in, raise, except, or, not, if, elif, print, import, etc
  2. Identifiers: Identifiers are the names given to any variable, function, class, list, methods, etc. for their identification.
  3. Literals or Values:Literals are the fixed values or data items used in a source code.
  4. Operators: These are the tokens responsible to perform an operation in an expression. The variables on which operation is applied are called operands.
  5. Punctuators: These are the symbols that used in Python to organize the structures, statements, and expressions. Some of the Punctuators are: [ ] { } ( ) @ -= += *= //= **== = , etc.
3 Likes

I appreciate you keep practicing @vaishu.swap10112016

1 Like