Bird
Raised Fist0

What is the correct way to write a multi-line comment in Python?

easy🧠 Conceptual Q2 of Q15
Python - File Reading and Writing Strategies
What is the correct way to write a multi-line comment in Python?
AUse /* and */ to enclose the comment
BUse # only on the first line of the comment
CUse // at the start of each comment line
DUse triple quotes (''' or """) around the comment text
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python comment syntax

    Python uses # for single-line comments and triple quotes for multi-line comments.
  2. Step 2: Identify correct multi-line comment style

    Only triple quotes (''' or """) can enclose multi-line comments in Python.
  3. Final Answer:

    Use triple quotes (''' or """) around the comment text -> Option D
  4. Quick Check:

    Multi-line comment = Triple quotes [OK]
Quick Trick: Use triple quotes for multi-line comments [OK]
Common Mistakes:
MISTAKES
  • Using /* */ like other languages
  • Using // for comments
  • Only placing # on the first line

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes