Page 100 - KEC Khaitan C7 Flipbook
P. 100
Output
Output: Enter the First Number: 12
Enter the Second Number: 45
Enter the Third Number: 23
Second number is the greatest number.
STRING
A sequence of characters which is enclosed or surrounded by single (' '), double (" "), or Triple
(''' ''') quotes is known as a string. The sequence may include a letter, number, special characters
or a backslash. Python treats single quotes as double quotes.
Program 6: To print a string
Program6.py
File Edit Format Run Options Window Help
str = "This is Shweta's pen." Output
print(str) This is Shweta's pen.
CREATING A SINGLE-LINE STRINGS
Single-line strings can be created by enclosing characters inside single or double quotes. It is like
assigning a value to a variable.
Program 7: To create a single-line string
Program7.py
File Edit Format Run Options Window Help
first_name = 'Aadya'
print (first_name)
last_name = 'Kaushal'
Output
print (last_name)
str = ' ' Aadya
print (str) Kaushal
CREATING MULTILINE STRINGS
A multiline string in Python begins and ends with either three single quotes or three double
quotes. Any quotes, tabs, or newlines in between the “triple quotes” are considered part of the
string.
98 Premium Edition-VII

