Interviews - C# Corner

Dinesh Beniwal
How do you write comments in python?
By Dinesh Beniwal in Python onJun 24 2019
  • Rohit Gupta
    Jul, 2019 10

    As the following format

    1. Using #- single line comments
    2. Using “”” “”” - for multi line comments

    • 2
  • Bidyasagar Mishra
    Jul, 2019 5

    # is used for single line comments
    Example:

    1. #this line will not execute due to single line comment
    2. print("hello this will execute")

    ”””””” is used for multiline line comments
    Example:

    1. """This will not
    2. execute due to
    3. multiline comments"""
    4. '''Also this will not
    5. execute due to
    6. multiline comments '''
    7. print("hi")

    • 2
  • Sourabh Somani
    Jul, 2019 2

    There are two ways to comment in the python

    • Single line Comments using Hash or Pound # Symbol
    • Multiline Comments Using Tripple Quote """ """

    Single Line Comments

    We can use Hash and pound symbol
    Example

    1. # This is single line comment
    2. print("Hello C# Corner") # This is python print function
    3. # End of the program

    Multiline comments

    We can use triple quotes
    Example

    1. """
    2. This
    3. is
    4. multiline comments
    5. """
    6. '''
    7. This
    8. is also
    9. multiline comments
    10. '''

    You can also use comments to define documantation of the program. For that you can use docstring

    Note
    To read more about about docstring click on the following link

    Python DocString

    • 2
  • Amit Prabhu
    Jun, 2019 24

    using hash (#). # this is the comment

    • 2
  • Md Sarfaraj
    Jul, 2019 24

    Using # symbol you can comment any line in python

    • 0
  • Arvind Singh Baghel
    Jul, 2019 18

    using # for single line comment

    single line comment

    print(“Hello, python”)

    using triple quotes “”” for multiline comment
    “””
    This is my multi
    line comment
    “””

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS