logo

Comments

Comments can be added to computer programs. A comment is human readable text that is not executed by Python.

Python has several possibilities to add comments.

Single line comments


Single line comments can be added using the numbersign:


# Show the world a message
print('Hello World')

Mutliline comments


If you want to add stories or a few sentences, Python offers two ways:


# Calculate the sum of x+y
# Used in calculator app
z = x + y

Another accepted method is:


'''
We can type multiple lines of commment
if we use the indicator.
'''

Next

Leave a Reply

Login disabled