Python MCQs with Explanation

How multiple line comments in Python are achieved?

  1. """ Comments goes here """
  2. ''' Comments goes here '''
  3. /* Comments goes here */
  4. Both a and b



Answer: 
Option d: Both a and b


In Python, there is no specific syntax for multiline comments like some other programming languages. However, you can achieve multiline comments in Python using a workaround by enclosing the comment block within triple quotes (''' or """). Although this technique is primarily intended for docstrings (commonly used for multi-lined string), it can also be used to create multiline comments.
 

Post a Comment

0 Comments