ch-1
ch-1
world”
>>>Text2=‘’’hello No backslash needed
world”’
Escape sequences
In Strings, you can insert non-graphic character through escape
sequence.
Escape sequences What it does
\\ Backslash ( \ )
\’ Single quote( ‘)
\” Double quote( “)
\a ASCII Bell
\b Backspace
\r Carriage return
\t Tab
Numeric Literals
Numeric Literals are numeric values and these can be
of 3 types
• Int: often called integers or ints, which can be positive or negative
number with no decimal points.
Ex- 48, -30
• Float: Float represents real number and are written with a decimal
point.
Ex-10.5,-5.2
• Complex number: Complex number are of form of a+bj, where a and
b are floats and j represents , which is an imaginary number, a is the
real part of the number, and b is the imaginary part.
Boolean Literals
Boolean Literals in Python is used to represent one of the two Boolean
values i.e. True or False.
For ex-
a=2==3
print(a)
Output- False
Special Literal
Python has one special literal, which is None. The None literal is used
to indicate absence of value. It is also used to indicate the end of list in
Python.
For ex-
a=None
print(a)
Output: None
Operators
Operators are the symbols that perform arithmetic and logical
operations on operands and provide a meaningful result.
An operator need one or more operands to perform any operations.
The valid combination of operand and operators makes an
expression which return computed result.
operators
Sum=a+b Expression
operands
Python support several types of
operators
• Arithmetic Operators (+, -, *, /, %, **, //)
• Relational Operators (<, >,==, >=, <=, !=)
• Identity Operators (is, is not)
• Logical Operators (and, or, not)
• Bitwise Operators (&, ̂ I)
• Membership Operators (in, not in)
• Assignment Operators (=, +=, /=, -=, %=, **=, //=)
Punctuators
Punctuators are the symbols that are used in programming languages
to organize sentence structure and indicates the rythms and emphasis
of expression, statements and program structure.
Most common Punctuators are-
‘ “ # \ () [] {} @ , : , . =