What are literals in Python ? How many types of literals are allowed in Python ?
Answers
Answered by
28
Answer:
A literal is a succinct and easily visible way to write a value. Literals represent the possible choices in primitive types for that language. Some of the choices of types of literals are often integers, floating point, Booleans and character strings.
Explanation:
Python support the following literals:
String literals :: "halo" , '12345'
Int literals :: 0,1,2,-1,-2
Long literals :: 89675L
Float literals :: 3.14
Complex literals :: 12j
Boolean literals :: True or False
Special literals :: None
Unicode literals :: u"hello"
List literals :: [], [5,6,7]
Tuple literals :: (), (9,),(8,9,0)
Dict literals :: {}, {'x':1}
Set literals :: {8,9,10}
Similar questions
English,
7 months ago
Science,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Chemistry,
1 year ago
Math,
1 year ago
Social Sciences,
1 year ago