Learn Before
Concept

Python Comments

Comments are used to explain python code and make the code easier to read. They aren't considered actual code and are essentially ignored during compilation. We can write a single line comment using # symbol

#this function takes two integers and prints the sum def sum(x,y): print(x+y)

The comment explains the purpose of the function sum

For a multiline comment, we can just put the comment inside triple quotes.

""" these lines are ignored """ print("Hello World")

0

1

Updated 2021-07-13

Tags

Python Programming Language

Data Science