Various String Literals in Python


#Example of String Literals
#Python has various Literals, which are shown in this program



print("Literals are oftenly known as CONSTATNT values, which have fixed values.")

String1="String Literals are written in double quotes."
String2='String Literals are written in double quotes.'
String3="Amy's brother is an 'Engineer'.
#Here multi line literal for string is used.
String4="Hello\
World"     
String5="'A\
B\
C\'"

print(String1);
print(String2)
print(String3);
print(String4)
print(String5)



Output

>>>
Literals are oftenly knwon as CONSTATNT values, which have fixed values.
String Literals are written in double quotes.
String Literals are written in double quotes.
Amy's brother is an 'Engineer'.
HelloWorld
'ABC'
>>> 




No comments

Post your comments

Powered by Blogger.