3 Dec 2020

Comments and DOCSTRING

COMMENTS:
   
           * A hash sign (#) is the beginning of a comment.
           * Anything written after # in a line is ignored by interpreter.    
        Eg: percentage = (minute * 100) / 60 # calculating percentage of an hour 
            * Python does not have multiple-line commenting feature. 

     Eg : # This is a comment. 
            # This is a comment, too.
           # I said that already.



DOCSTRING:
       
           Docstring is short for documentation string. It is a string that occurs as the first statement in a module, function, class, or  
method definition. We must write what a function/class does in the docstring. Triple quotes are used while writing docstrings. 

Syntax:

Fuctionname__doc.__ 

Example :

def double(num):
"""Function to double the value"""
return 2*num
>>> print(double.__doc__)
Function to double the value

No comments:

Post a Comment

Operator precedence

           When an expression contains more than one operator, the order of evaluation depends on the order of operations.            The ac...