1. Home
  2. Data Science
  3. Python
  4. Which of the following is a valid way to comment out…

Added 25 Jan 2024

Which of the following is a valid way to comment out multiple lines in Python?

  1. /* ... */
  2. // ... //
  3. # ... # Correct answer
  4. <!-- ... -->

Correct answer

C. # ... #

14 views

MCQSEXAM

Explanation

Python has no dedicated multi-line comment syntax, so the valid approach is to start each line with #.

Triple-quoted strings ("""...""") are often used as block comments, but they are really string literals (docstrings). /* */, // and <!-- --> are comment styles of C, JavaScript and HTML.

Keep preparing with more Computer Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs