COMPANY NAME
Dr. Sunil Kumar
PGT
JNV Mohindergarh
Navodaya Vidyalaya Samiti
Computer Science with Python
XII (As Per CBSE Curriculum)
Will Learn……..
What is Tokens ?
What is Keyword ?
What is Identifiers ?
What is Operators ?
What is Punctuators ?
Tokens in Python
Keyword
Identifiers (Names)
Literals
Operators
Punctuators
Keywords (Tokens)
35
True, False, None
Identifiers (Tokens)
•An identifier is a user-defined name to represent a
variable, a function, a class, a module, or any other object.
•It is a programmable entity in Python- one with a name.
•It is a name given to the fundamental building blocks in a
program.
Identifiers (Tokens)
• Python identifier can be a combination of
lowercase/ uppercase letters, digits, or an
underscore.
o Lowercase letters (a to z)
o Uppercase letters (A to Z)
o Digits (0 to 9)
o Underscore (_)
• An identifier cannot begin with a digit.
Literals
String
Literals
Single Line
String
Multi-line
String
Special
literals
None
Numeric
Literals
Int(signed
integers)
Decimal
Form
Octal
Form
Hexadecimal
Form
Long(long
integers)
float(floating
point)
0.17E5
3.E2
Complex
(complex)
a+bj
Boolean
Literals
Literal
Collections
List literals, Tuple literals, Dict literals, and Set literals
Arithmetic
Operators
Relational
Operators
Assignment
Operators
Logical
Operators
Bitwise
Operator
s
Membership
Operators
Identity
Operators
Operators in Python
Arithmetic
Operator
Addition
(+)
Subtraction
(-)
Multiplication
(*)
Division
(/)
Floor
Division
(//)
Exponentiation
(**)
Modulus
(%)
Arithmetic Operators
Punctuators
Punctuators are symbols (‘ “  () [ ] { } @ , : ‘ =) that are
used in programming language to organize sentence
structure and indicate the rhythm and emphasis of
expressions, statements and program structure
Subtraction
Addition
Parenthesis
Exponent
Multiplication
Division
Blocks
Expressions-Represent a Value
Statements-Programming Instructions
Comments-Readable information
Functions-Named code section
Block-Group of Statements
P
R
O
M
M
I
N
G
S
T
R
U
C
T
U
R
E
02
04
01
NUMBERS
a. Integers
a. Integers
b. Boolean
b. Floating Point Numbers
c. Complex Numbers
LIST
A list in Python represents a group of comma-
separated values of any data type between
square brackets []
TUPLE
Tuple is represented as a group of
comma-separated values of any data
type withing parenthesis ().
STRING
All strings in Python 3.0 are sequence of pure
Unicode. Unicode is a System designed to
represent every character from every
language. String can hold any type of known
character
Data Types
DICTIONARY
Dictionary is an unordered set of
comma separated key:value pairs,
within { } . No two keys can be same.
06
SET
A Set is a mutable data type which is created
like lists { }. It can take values of different
types.
02
01
MUTABLE TYPES
Mutability means that in the same memory address ,
new values can be stored as and when you want. The
types that do not support this property is known as
immutable.
IMMUTABLE TYPES
The immutable types are those that can
never change their value in place.
Integers, Floating point numbers,
Booleans, Strings, Tuples
MUTABLE AND IMMUTABLE TYPES
Type Casting
02
01
EXPLICIT TYPE CONVERSION
An Explicit type conversion is user defined
conversion that forces an expression to be of
specific type. Explicit type conversion is also
known as Type Casting.
Implicit Type Conversion
Implicit Type conversion means the type
of conversion, which is automatically
performed by the compiler.
01
The simplest statement is the empty
statement i.e., a statement which does
nothing . (pass statement)
Empty Statement
02
Compound statements are made of
simple statement. Any executable
statement is a simple statement.
Simple Statement
03
Compound Statement represents a group
of statements executed as a unit. Such type
of statement are written in specific pattern
Compound Statement
Statement Flow Control may be executed sequentially or iteratively.
Every programming language provide constructs to support sequence,
selection or iteration
Statement flow
Control
01
IF CONDITION
02
If-else
statement
03
If-elif
04
Nested if
05
Storing Condition
THE IF CONDITIONALS
Decision
Making
If Statement
Condition
True
False
Block of Code
If-else Statement
Condition
True
False
Block of Code
Block of Code
Condition 1
True
False
Block of Code
Block of Code
Block of Code
True
Condition 2
Condition 3
False
True
elif
ladder
elif
ladder
Condition 1
True
Block of Code
Block of Code
Block of Code
Condition 2
Condition 3
False
True
if
else
ladder
True
False
False
Nested
loops
in
Python
break statement
continue statement

Python revision tour -I