Floor Division Operator
To find integral part of quotient we use Floor Division Operator
//
- a // b
Code
PYTHON
Output
Compound Assignment Operators
Different compound assignment operators are
+=
, -=
, *=
, /=
, %=
a += 1
is similar to a = a + 1
Code
PYTHON
Output
Examples of Compound Assignment Operators
Code
PYTHON
Output
Code
PYTHON
Output
Escape Characters
Single And Double Quotes
String is a sequence of characters enclosed within quotes.
Code
PYTHON
Output
Code
PYTHON
Output
Escape Characters
Escape Characters are a sequence of characters in a string that are interpreted differently by the computer. We use escape characters to insert characters that are illegal in a string.
Code
PYTHON
Output
We got a new line by adding
\n
escape character.Examples - Escape Characters
Escape Characters start with a backslash in Python
- \n-> New Line
- \t-> Tab Space
- \\-> Backslash
- \'-> Single Quote
- \"-> Double Quote
Passing Strings With Quotes
The backslash
\
character here tells Python not to consider the next character as the ending of the string.Code
PYTHON
Output
Code
PYTHON