Answer to Question #236661 in Python for Nana

Question #236661

As programs get bigger and more complicated, they get more difficult to read.this is one reason why programmers should use comments in their code


1
Expert's answer
2021-09-13T18:28:29-0400

Comments, depending on the situation, do several useful things at once:


  1. They help to understand the code faster - if an error appears or the program needs to change something. This is important for both the developer and those who will be working on the code after it.
  2. Do not get confused in logic - when creating new libraries, procedures, functions, and system variables.
  3. Explain the results of work - when debugging or testing a program. This understanding is needed by the QA testers.
  4. Describe complex algorithms and formulas - in mathematical, physical, or economic calculations and other complex calculations. This allows those who do not have deep knowledge in some subject area to understand the finished code.


Comments are in one line: such comments begin with the # symbol

Example:

# This is a one line comment

Or comments can be multi-line, for this you need the text that you want to comment out, enclose in triple quotes

Example

"""
This is a multi-line comment,
created with
triple quotes
"""

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS