-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5CommentsEscapeSequenceANDPrintStatement.py
18 lines (17 loc) · 1.41 KB
/
5CommentsEscapeSequenceANDPrintStatement.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# In this class we shall first learn about the Escape Sequence , for example we want to print a statement in more than one lines
# but we dont want to write three different lines of code for it then how can we do it . We can do it by using the Escape Sequence
# code which is '\n'. By, using this we can print a statement in different lines as we want.
print("Hey I am Dhruba \nI am an 18 year old boy \nI am a resident of Bongaigaon,Assam.")
# If you see that this will print this statement in three lines.
# We have already been using this '#' as a commenter. Now, IDEs provide a shortcut to comment different lines. Just, select it using
# the mouse and then press the short-cut 'Ctrl+/'.
# We also have another method to do multi-line comment i.e by using ''' ''' three inverted commas.
# Let's talk about print statement.
# Let's see what is a separator . So, this basically separates the words or the statement by our prefered character. Let's see
print("Hello","I am using","A separator","To show you guys its use.", sep='--')
# You see the statements have been separated by '--'.
# Now let's see what can the end='' command do.
print("Dhrubajit",6,7, sep='~',end='123 \n')
print("This is the use of end command. \n")
# So, now you can see this end command with \n appends 123 at the end of the line of the print statement. The use of \n or null is to
# print the next entered code in the next line. As, you can see in the above example.