#Python Token
#List of Python Tokens
-Keywords
-Identifier
-Literals
-Operators
-Kewwords:
Keywords are pythons reserved words, they convey a special meaning to
the compiler/interpreter. Each keyword has a certain meaning and a
certain opperation that it needs to carry out. Never use a keyword as
a variable as that could cause lots of complications and mistakes.
-Identifier:
An Identifier is a name used to identify a variable, function,
class or object.
Rules of Identifiers:
->No special characters exepct underscores(_),can be used as
an identifier
->Keywords should not be used as an identifier
->Python is case sensitive, Var with a capital V and var with
a lowercase v are two separate identifiers
->The first character of an identifier can be an alphabet or
underscore but not a digit
-Literals:
There are many types of literals such as the following
Types of Literals:
->string literals
->numeric literals
->boolean literals
->special literals
-Operators:
Operators are special symbols that are used to carry out aritmetic
and logic operations
Various Types of Operators:
->Arithmetic
->Assigment
->Comparison
->Logical
->Bitwise
->Identity
->Membership
"""
Tokens: Python breaks each logical line into a sequence of elementary
lexical components known as tokens. Each token corresponds to a substring
of the logical line. The normal token types are identifiers, keywords,
operators, delimiters, and literals, as covered in the following sections.
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.
Identifiers: Identifiers are the names given to any variable, function,
class, list, methods, etc. for their identification.
Python is a case-sensitive language and it has some rules and regulations
to name an identifier.
Literals or Values: Literals are the fixed values or data items used in a
source code. Python supports different types of literals such as:
String Literals.
Character Literals: Character literal is also a string literal type in which
the character is enclosed in single or double-quotes.
Numeric Literals: Integer Literal, Float Literal and Complex Literal
Boolean Literals: Boolean literals have only two values in Python. These are True and False.
Special Literals: Python has a special literal ‘None’. It is used to denote nothing, no values,
or the absence of value.
Special Literals: Python has a special literal ‘None’. It is used to denote
nothing, no values, or the absence of value.
Literals Collections: Literals collections in python includes list, tuple, dictionary, and sets.
Operators: These are the tokens responsible to perform an operation in an
expression.
"""
# Operators
a = 12
# Unary operator
b = ~ a
# Binary operator
c = a+b
# Driver code
print(b)
print(c)
# Output
# -13
# -1
"""
Punctuators: These are the symbols that used in Python to organize the
structures, statements, and expressions. Some of the Punctuators are:
[ ] { } ( ) @ -= += *= //= **== = , etc.
"""
#PythonTokens
*Keywords--> False,True,return
*Literals--> datatypes like bool,int,float
*Operators--> arithmatic and logic computation like /,//,**,*,+,-
*Identifiers--> some random combinations of character like alphabets,digits,etc.
*Punctuators--> parentheses ( ) , braces { } these are punctuators