Introduction
Comments help explain what the code does. They make code easier to understand for you and others.
Jump into concepts and practice - no test required
Comments help explain what the code does. They make code easier to understand for you and others.
# This is a single-line comment ''' This is a multi-line comment '''
# and go to the end of the line.''' or """ but are actually multi-line strings not assigned to a variable.# This is a comment explaining the next line print('Hello')
''' This is a multi-line comment. It can span several lines. '''
print('Start') # This comment is after code on the same line
The comments explain what the program and the print line do.
# This program prints a greeting message print('Hello, friend!') # Print greeting
Comments do not affect how the program runs.
Use comments to make your code easier to read and maintain.
Keep comments clear and concise.
Comments explain code and help others understand it.
Use # for single-line comments.
Use triple quotes for multi-line comments or notes.
# symbol to start a single-line comment.// or /* */ are used in languages like JavaScript or C, not Python.''' or triple double quotes """ for multi-line comments or docstrings.print('Hello') # This prints Hello
# print('World')# This is a comment
print('Start')
'''This is a comment without an end
print('End')# at the start of each line.