Python Programming – Token

You can learn about Introduction to Python Programming Programs with Outputs helped you to understand the language better.

Python Programming – Token

The smallest individual unit or element in a program is known as a token a lexical unit. Each token should be separated from the other by a space, tab, or carriage return, which is collectively termed white space. Python has the following tokens which are discussed below: keywords, identifiers, literals (constants), punctuators, and operators.

Keywords: At the time of designing a language, some words are reserved to do specific tasks. Such words are called keywords or reserved words. Keywords are the reserved words in Python. They are used to define the syntax and structure of the Python language.

Identifiers: An identifier is a user-defined name given to different parts of the program, namely variable, class, object, and function.

Literals: Literals can be defined as data that is given in a variable or constant.

Punctuators: Punctuators are symbols that are used in programming languages to organize sentence structure, and indicate the rhythm and emphasis of expression, statements, and program structure. For example ‘(Single Quote),” (Double Quote), # (Hash), \ (forward slash), () (parenthesis), [] (Square bracket), {} (Curly bracket), (comma), : (colon), = (Assignment) etc.

Operators: Operators are special symbols in Python that carry out arithmetic or logical computation.

Leave a Reply

Your email address will not be published. Required fields are marked *