Comments

A comment is text that the compiler ignores but is useful for programmers. Comments are typically used to annotate code for reference. The compiler treats them as spaces. You can use comments during the test to make certain lines of code inactive.

Syntax

# single line comment

# multi
# line
# comment

"""
multi
line
comment
"""

# comment including description and parameters
def add(a, b):
    """
    Addition of two numbers

    :a: first number
    :b: second number
    :return: result

    :Example:

    >>> add(12, 8)
    20
    """

    result = a + b
    return result

Example

def add(x, y):
    """
    Addition of two numbers

    :a: first number
    :b: second number
    :return: result

    :Example:

    >>> add(12, 8)
    20
    """
    return x + y

# Variable declaration and initialization
x, y = 2, 4

print(add(x, y)) # Output
Output
6