How to write comments
Comments : It is used to mark a section of code as non-executable.
Python has two types of comments.
Python has two types of comments.
- Single-line comment : (# hash is used as comment in python whereas in C it is used to define preprocessor commands)
- Docstring comment : (Triple quote either """ or ' ' ' is used as docstring comment)
Examples :
Single-line comment :
# Hello World!!!
Docstring comment :
""" Author : Codintechnoledge
Date : Unknown """
OR
' ' ' You can write multiple lines here
and can even print docstring with attribute __doc__ ' ' '
Example on __doc__ :
def multiplier(a, b) :
""" This built-in function takes two input and returns their product.""
return a*b
print(multiplier.__doc__)
Output :
>> This built-in function takes two input and returns their product.
<<<<<< BACK Click here for INDEX
<<<<<< BACK Click here for INDEX
Comments
Post a Comment