Python 2 22
Python 2 22
Tokens
The smallest individual unit in a program is known as a token. There are five types of
tokens allowed in Python.
Python Character Set
• Letters: A - Z, a - z
• Digits : 0 - 9
11/16/2023 4
Examples
Variables
a = 2
print(type(a))
# Output: <type 'int'>
q = True
print(type(q))
# Output: <type 'bool'>
Assignment Statements
A single value can be assigned to several variables
simultaneously
a = b = c = 1
print(a, b, c)
# Output: 1 1 1
Python keywords
>>>import keyword
>>>print(keyword.kwlist)
11/16/2023 12
Correct indentation :
if 5 > 2:
print("Five is greater than two!")
Python 3 disallows mixing the use of tabs and spaces for indentation.