Introduction to Programming Using Python — Question 38
You develop a Python application for your company.
You want to add notes to your code so other team members will understand it.
What should you do?
Answer options
- A. Place the notes after the # sign on any line
- B. Place the notes after the last line of code separated by a blank line
- C. Place the notes before the first line of code separated by a blank line
- D. Place the notes inside of parentheses on any time
Correct answer: A
Explanation
The correct answer is A because comments in Python are created using the # symbol, allowing for inline explanations on any line. Options B and C suggest placing comments in positions that do not adhere to Python's commenting conventions, which would not be effective for code clarity. Option D is incorrect as comments cannot be enclosed in parentheses in Python.