What is Python?
Python is a general purpose and high level programming
language.
You can use Python for developing desktop GUI applications,
websites and web applications.
It was released in 1991 by Guido van Rossum.
Character Set
Set of valid characters that a language can recognize
1. Letters-A to Z,a to z
2. Digits-0 to 9
3. Special Symbols-+,-,*,%,/,//,{},[],(),# etc
4. White Spaces -blank space,new line etc
Tokens
Reserved Words
● Keywords are the words that convey a special meaning to the language
processor.
● They can be used only for special purpose
Identifiers
Identifier is a name used to identify a variable,function,module etc
Rules for naming a variable:
● The first character must be a letter or underscore(_)
● Only Special character allowed is (_)
● No keywords
● No space
Constants/Literals
Numeric String Boolean Special literal
Integer True
Float False None
Comple
x
Constants/literals
Integer Constant String Constant
1. Decimal (a=6) 1. Single line string
2. Octal (a=0o6) 2. Multi line string
3. Hexadecimal (a=0x6) 3. Escape Sequences
4. Boolean (a=0b1101)
1. Arithmetic
2. Relational
3. Logical
Operator 4. Assignment
Membership
Types 5.
6. Identity
7. Bitwise
8. Shift
Arithmetic
1. +
2. -
3. *
4. /
5. //
6. %
7. **
Relational
1. <
2. >
3. <=
4. >=
5. ==
6. !=
Logical
1. And
2. Or
3. not
Assignment
1. = Assignment
2. /= Assign Quotient
3. += Assign sum
4. *= Assign product
5. %= Assign remainder
6. -= Assign difference
7. **= Assign exponent
8. //= Assign floor division
Membership
1. In whether variable is available in sequence
2. Not in whether variable is not in sequence
Identity
1. Is is the identity same?
2. Not is is the identity not same?
Bitwise
1. & Bitwise And
2. | Bitwise OR
3. ^ Bitwise XOR
4. ~ Bitwise complement
Shift
1. << shift left
2. >> shift right