Python Character Set- Character set is a set of valid characters that a language can recognize. A character represents any letter, digits or any other symbol. Python can process all ASCII and Unicode characters.
Tokens- The smallest individual unit in a program is known as a Token or lexical unit. Pythons has the following tokens: (i) Keywords (ii) Identifiers (Names) (iii) Literals (iv) Operators (v) Punctuators


A Keyword is a word having special meaning reserved by programming language. These are reserved for special purpose and must not be used as normal identifier names.Some keywords are: while, or, if, else, from, and, import, not return, break, class, True, False, None, global, etc.

Identifier (Names)-

Identifiers are fundamental building blocks of a program and are used as the general terms for the names given to different parts of the program (variables, objects, classes, functions, list, etc.)

Identifier forming rules of Python –

• The first character must be a letter; the underscore(_) counts as letter. • Upper and lower- case letters are different. • The digits 0 through 9 can be part of the identifier except for the first character. • An identifier must not be a keyword. • An identifier cannot contain any special character except for underscore (_). • Identifiers are unlimited in length. Python is case sensitive as it treats upper and lower –case character differently.

Some valid Identifier – Myself   num1   _roll  _Ht13_h  Myfile  file13
Some invalid Identifier – Data-rec  break  29click  my.file  if   else   while   roll*no

Literals/ Constant Values -

Literals or Constant values are data items that have fixed value. Python allows several kinds of Literals:
  ( i ) String literals  (ii) Numeric literals   (iii) Boolean literals   (iv) Special Literal None
String Literals- A String literal is a sequence of characters surrounded by quotes (single or double or triple quotes).
 “ravi”  ‘viresh’  ‘123fds34’  “1-x-0-w-25”  “10287382”
String Types in Python –
Python allows you to have two string types:
 (i) Single line strings  (ii) Multiline strings
Single line strings (Basic Strings)- The strings that you create by enclosing text in single quotes (‘ ‘) or double quotes (“ “) are normally single line strings. They must terminate in one line.
>>> text1=“Hello India”

Multiline strings – It allows us to store text spread across multiple lines as one single string.
Multiline string can be created in two ways:
 (a)By adding a backslash at the end of normal single/ double quote strings.
>>> text1=“ Hello India \
  Good Morning ”
 (b) By typing the text in triple quotation marks. (No backlash needed at the end of line).
>>> text1 = ‘’’ Hello India
  Good morning
  How are You’’’
Numeric Literals- The numeric literals in Python can belong to any of the following different numerical types:-
  int   long   float

int- are positive or negative whole numbers without no decimal point.
long- are integers of unlimited size, written like integers and followed by an uppercase or lowercase L. 33L is a long integer whereas 33 is an integer.
float- float represent real numbers and are written with a decimal point.

Floating point literals- They are also called real literals. Real literals are numbers having fractional parts. These may be written in one of the two forms called Fractional Form or the Exponent Form.
Fractional form- a real literal in fractional form consists of signed or unsigned digits including a decimal points between digits. Eg.,-2.0, 17.5, -14.6, -0.00562
Exponent form-a real literal in Exponent form consists of two parts: mantissa and exponent. For instance, 5.8 can be written as 0.58 x 101 = 0.58E01, where mantissa part is 0.58 (the part before E) and exponent part is 1 (the part after E). E01 represents 101. Eg., 152E05, 1.5E07

Boolean literals-

A Boolean literal in Python is used to represent one of the two Boolean values i.e., True (Boolean true) or False (Boolean false).
 True and False are the only two Boolean literal values in Python .

Special literals None -

Python has a special literal, None. The None literal is used to indicate something that has not yet been created. It is also used to indicate the end of lists in Python.

Displaying a variable containing None does not show anything. However, with print , it shows the value containing as None .

Operators: Operators are used to perform some operations. E.g., +,-, >, <, >=, etc.
Separators are symbols that indicate the division and arrangement of groups of code. The structure and function of code is generally defined by the separators.

The operators are tokens that trigger some computation/ action when applied to variables and other objects. Variables and objects to which the computation is applied, are called operands.
Arithmetic Operators- To do arithmetic, Python uses operators. It provides operators for seven basic arithmetic calculations: +, -, *, /, //, **, %. Each of these operators is a binary Operators (They require two values (operands)). Java also provides two unary arithmetic operators (that require one operand) which are unary + ,unary - .
b= -40 # Assign ‘b’ a negative 40

Operators that act on one operand are referred to as Unary Operators.
Operators that act upon two operands are referred to as Binary Operators.

Relation Operators:

The relation operators determine the relation among different operands. Python provides six relational operators for comparing numbers and characters. But they don't work with strings.
If the comparison is true, the relational expression results into the Boolean value true and to the Boolean value false, if the comparison is false.
Relational Operators:     >  >=  <  <=  = =   !=

Logical/ Conditional Operators: 

 && AND operator (if both the condition are true then results into true else results in false)
 || OR operator (if any one of the condition is true, results in true else results in false)
! NOT operator (reverses the result, if the result is true changes it to false and vice-versa)

Assignment Operators:

Python offers an assignment operator =, to assign one value to another eg .,
a = b = c = 20

Expression: An Expression is any valid combination of operators, constants, and variables i.e., a legal combination of tokens.

Block: A block is a group of zero or more statements between balanced braces and can be used anywhere where a single statement is allowed.


In Python variable represents named location that refers to a value and whose values can be used and processed during program run.

We can say a variable is an object that refers to a value.
>>> id (4)
30899132 # Object 4 is internally stored at location 30899132
>>> a=4
>>> id (a) # Variable a is currently referencing location 30899132

Variable a is pointing to location 30899132. Therefore when we will give print(a) command it will display the value that is stored in memory location 30899132.
>>> print(a)

In Python a variable does not store a value instead variable names are stored as references to a value object. Each time you change the value, the variable's reference memory address changes.

The following types are immutable in Python- Integer , Floating point number booleans , Strings tuples

The following types are mutable in Python- lists, dictionaries

Mutable means that in the same memory address, new value can be stored as and when you want.

The types that do not support this property are immutable types.

Immutable data types are those that can never change their value in place.

(changing in place means modifying the same value in same memory location).

Tea Or Coffee

Python Downloads

Reindexing and Label Alteration
Function Application –Python pandas
Bar Charts and Histograms and Quantile
Plottint with PyPlot-2


Ways to Keep Your Brain Healthy