Programmers Arena: Tokens in Python

Tokens in Python

Tokens for python are somehow the same as C++,

IDENTIFIER--> names given by a programmer to identify a variable, function etc.
example-
>>> a=10
>>> b=a*a
>>>print b
>>>100

It should have some symbolic reference to what it is serving so as to make it easy to identify its purpose.

IDENTIFIER NAMING CONVENTIONS-
They should start with A-Z, a-z, underscore( _ )
It can then be followed by any digit (0-9)
You cannot use reserved words or keywords as identifiers.
( note that reserve words or keywords have a special meaning to the programming language.)

OPERATORS-

Operators are the symbols with mathematical significance to Python such as symbols for addition, subtraction, multiplication etc.

MATHEMATICAL HIERARCHY-
1. ** : Exponent
2. *, /, % : Multiplication, Division, Modulus
3.+, - : Addition, Subtraction

COMPARISION OPERATORS-
1. == : signifies that the L.H.S. is equal to R.H.S.
2. <=: smaller than equal to
3. >= : greater than equal to
4. <>: not equal to
5. !=: not equal to
6. < : smaller than
7. > : greater than

No comments:

Post a Comment

Copyright © Programmers Arena