Which symbol is used to add the comment in the code or program to make it more…
2024
Which symbol is used to add the comment in the code or program to make it more readable and understandable in Python programming language?
Answer: A. # — Concept: A comment is source text meant only for human readers; the language interpreter skips it during execution, and each language marks comments with its…
- A.
#
- B.
*
- C.
-
- D.
:
Attempted by 958 students.
Show answer & explanation
Correct answer: A
Concept: A comment is source text meant only for human readers; the language interpreter skips it during execution, and each language marks comments with its own dedicated symbol.
Application: In Python, that marker is the hash symbol #. Everything written after an unquoted # on a line, through the end of that line, is treated as a comment and ignored when the code runs — a # that appears inside a string literal (for example the # in the string "#tag") is just ordinary text, not a comment marker.
Contrast: the remaining symbols already have other jobs in Python syntax, so none of them can double as the comment marker:
* is the multiplication operator (it also unpacks iterables and marks keyword-only arguments).
- is the subtraction operator, or the unary negation sign on a number.
: introduces the indented block (suite) after statements like if, for, def, and class — it never starts a comment.
So the symbol that adds a comment in Python is #.