line string literal. A Character literal is also considered as string literal in Python. # Demo Program to test String Literals strings = "This is Python" char = "C" = "'This is a multiline string with more than one line code."' print (strings) print (char) print ( ) # End of the Program Output: This is Python C This is a multiline string with more than one line code. Program .
To test String Literals 12th Computer Chapter - - Python – Variables and Operators (iii) Boolean Literals A Boolean literal can have any of the two values: True or False. # Demo Program to test String Literals = True = False print ("Demo Program for Boolean Literals") print ("Boolean Value1 :", ) print ("Boolean Value2 :", ) # End of the Program Output: Demo Program for Boolean Literals Boolean Value1 : True Boolean Value2 : False Program . To test Boolean Literals: (iv) Escape Sequences In Python strings, the backslash "\" is a special character, also called the "escape" character. It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a carriage return.
For example to print the message "It's raining", the Python command is >>> print ("It\'s rainning") It's rainning Python supports the following escape sequence characters. Escape sequence character Description Example Output \\ Backslash >>> print("\\test") \test \’ Single-quote >>> print("Doesn\'t") Doesn't \” Double-quote >>> print("\"Python\"") "Python" \n New line print("Python","\n","Lang..") Python Lang.. \t Tab print("Python","\t","Lang..") Python Lang.. .
Python Data types All data values in Python are objects and each object or value has type. Python has Built-in or Fundamental data types such as Number, String, Boolean, tuples, lists, sets and dictionaries etc. 12th Computer Chapter - - . .
Number Data type The built-in number objects in Python supports integers, floating point numbers and complex numbers. Integer Data can be decimal, octal or hexadecimal. Octal integer use digit (Zero) followed by letter ' o ' to denote octal digits and hexadecimal integer use 0X (Zero and either uppercase