Literals / Values
 Literals are data itemsthat havea fixed value.
Pythonsupportsseveral kindsof literals:
String Literal
Numeric Literals
Boolean Literals
Special Literals – None
Literal Collections
String Literals
 It isa collection of character(s) enclosedina double or
single quotes
 Examplesof Stringliterals
“Python”
“Mogambo”
„123456‟
„Hello Howare your‟
„$‟,„4‟,”@@”
 InPythonboth singlecharacter or multiple characters
enclosedin quotessuchas“kv”, „kv‟,‟*‟,”+” are treated
as same
Non-Graphic (Escape) characters
 They are the special characters which cannot be
type directly from keyboard like backspace, tabs,
enter etc. When the characters are typed they
perform some action. These are represented by
escape characters. Escape characters are always
beginsfrom backslash() character.
Listof Escapecharacters
Escape Sequence Whatit does Escape Sequence Whatit does
  Backslash r Carriage return
‟ Single quotes t Horizontal tab
” Double quotes uxxxx Hexadecim
al value(16
bit)
a ASCII bell Uxxxx Hexadecim
al value(32
bit)
b Back Space v vertical tab
n New line ooo Octal value
Watch Demo on YouTube

Literals notes.pptx

  • 1.
    Literals / Values Literals are data itemsthat havea fixed value. Pythonsupportsseveral kindsof literals: String Literal Numeric Literals Boolean Literals Special Literals – None Literal Collections
  • 2.
    String Literals  Itisa collection of character(s) enclosedina double or single quotes  Examplesof Stringliterals “Python” “Mogambo” „123456‟ „Hello Howare your‟ „$‟,„4‟,”@@”  InPythonboth singlecharacter or multiple characters enclosedin quotessuchas“kv”, „kv‟,‟*‟,”+” are treated as same
  • 3.
    Non-Graphic (Escape) characters They are the special characters which cannot be type directly from keyboard like backspace, tabs, enter etc. When the characters are typed they perform some action. These are represented by escape characters. Escape characters are always beginsfrom backslash() character.
  • 4.
    Listof Escapecharacters Escape SequenceWhatit does Escape Sequence Whatit does Backslash r Carriage return ‟ Single quotes t Horizontal tab ” Double quotes uxxxx Hexadecim al value(16 bit) a ASCII bell Uxxxx Hexadecim al value(32 bit) b Back Space v vertical tab n New line ooo Octal value Watch Demo on YouTube