How do multiline comment in python in our replit application


Repl link/Link to where the bug appears:

Screenshots, links, or other helpful context:

code snippet

How do multiline comment in python in our replit application?


Hello @ParmarP and welcome to the community!

You can multi-line comments by using triple quotes ''' '''

For example, I’ll make a simple program that asks the user for their name:

def main():
    # One line comment will be like this
    name = input("What is your name? ")

    '''Now here in this part
       I can make a triple line comment to tell that I'll
       Be using this part to greet the user!'''
    print(f"Hello, {name}!")

if __name__ == "__main__":
This is a multiline comment
in Python using triple quotes.
It can span multiple lines.

This is another multiline comment
using double quotes.

# You can also use single-line comments with the '#' symbol.
# These are more commonly used for short comments.

The recommended way by PEP 8 is to just use multiple single line comments. In the editor, you can select multiple lines and then Ctrl+/ to comment (or uncomment) all of those lines.

# hello
# hi

Multiline strings can also be used: if they are not assigned to a variable and not at the start of a module, class, or function (these are docstrings), they will be ignored.

def f():
    """This is a docstring for function f.

    Docstrings should use double quotes.

    x: str = '''This is a multiline string (contains newlines)
abc  <- no indentation
    456  <- indentation counts: indented 4 spaces
    #  <- this is part of the string, not a comment
    '''  # <- newline with 4 spaces of whitespace at end
    This will be ignored by the interpreter (a comment)