Python Programming
About Lesson

String is basically a group of characters. It may be single character, word or even a sentence. We can simply store strings into a variable whose datatype will be considered by string by python implicitly.

#Example
str=”best”
type(str)
<class ‘str’>

We can either use single or double quotes to create a String literal while assignment.

#Example
name=”best computer institute”
name=’best computer institute’

We already learnt in this course that we can print strings using print() function.
#Example
print(“Welcome to”)
print(‘Best Computer Institute’)

Strings that span multiple lines
Multiline string is a string that spans into multiple lines. We can store a multiline string into a variable by using three quotes (either single or double)

#Example1
str = “””Python is
a versatile programming language
used for many purposes.”””
print(str)

#Example2
str = ”’ Python is
a versatile programming language
used for many purposes.”’
print(str)

You cannot copy content of this page