individual words and punctuation mark are called tokens or lexical units or lexical elements.
or
the smallest individual unit in a program is known as a Token.
Tokens are of five type:
1.Keywords 2.Identifiers(names)
3.Literals 4.Operators
5.Punctuators
1.What is keyword??
keyword are the words that convey a special meaning to the language compiler/interpreter.These are reserved for special purpose and must not be used as normal identifier names.
identifiers are fundamental building of blocks of a program and are used as the general terminology for the names given to different parts of program viz.variables, objects, classes, functions, lists etc.
__identifier forming rules of python:
- 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
_
. - An identifier cannot start with a digit.
- Keywords cannot be used as identifiers.
- We cannot use special symbols like !, @, #, $, % etc. in our identifier.
- An identifier can be of any length.
3.What are Literals ??
Literals are data items that have a fixed value.python allows several kinds of literals:
a.string literals b. Numeric literals
c.Boolean literals d.Special literals(None)
e.literal collection
4.What are Operators ??
Operators are tokens that triggers some computation when applied to variables and other objects in a expression.Variables and object to which the computation is applied, are called operands.
So, operators required some operands to work upon.
Operators are of two types:
a.Unary Operators: are that operator which require only one operand
eg: -5,+5 etc
b.Binary Operators:that requires two operands to work upon
eg: 7+8 etc
5.What are Punctuators ??
punctuartors are the symbols that are used in programming language to organize sentence structure, and indicate the rhythm and emphasis of expression , statements , and program structure.
eg:!,@,#,$,%,^,&,*,(,) etc.
FOR MORE DETAILS FOLLOW ME ON INSTAGRAM : "free.python_learning1"
No comments:
Post a Comment