Comments, Escape Sequences & Print Statement

Python Comments:


  • Comments are used to make the code more understandable for programmer.
  • Comments are not executed by Interpreter.


There are 2 methods to write comment in Python Language -:

  • Single Line Comment
  • Multi Line Comment


Single Line Comment : Single Line comments are the comments which are created in single line only i.e. they occupy the space of single line only.

  • We use # (hash/pound to write single line comment).
  • E.g. # this is a comment.

Multi Line Comment : Multi Line comments are the comments which are created by using multiple lines i.e. they occupy more than one line in the program.

  • We use “”” ….. Comment …. “”” for writing multi line comment i.e. (tripe quotes for writing multi-line comments).



Python Print Statement:


print() is a function in Python language which allows us to display whatever is written it i.e. inside print statement.


end : end command allows us to put something in the end of line i.e. in simple words it allows us to continue the line with ‘ ’ or ‘,’ or anything whatever we put inside these quotes of end. It simply joins two different print statements using some kind of symbol or even by space.


Escape Sequences :

  • An Escape Sequence in Python programming language is a sequence of characters.
  • It doesn’t represent itself when used inside string literal or character.
  • It is composed of two or more characters starting with backslash \.


Code file as described in the video

#Please dont remove this line
"""
This is a
Multiline Comment
"""
"""
This is a comment
"""
# print("Subscribe CodeWithHarry now","Bhai video bhi like kar dena")
# print("next line")
# print("C:\'narry")
print("Harry is \n good boy \t1") #comment after statement



Be the first person to comment!

Comments(0)