Python summary: comments

Comments are lines of code which do not run, and which are used for documenting (showing the programmer what a piece code does). This is useful:

  • When we review our code later (to remember what it does or view it fast).
  • For asking on forums.
  • Team work.

In Python, comments start with a hash character (#):

# Displaying a name
print("Guido van Rossum")
print("Guido van Rossum") # Displaying a name

 

If we want a multiline comment, we can use either some hashes or a triple quote (the second one is the pro way):

# Displaying
# a name
print("Guido van Rossum")
'''Displaying
   a name'''
print("Guido van Rossum")
Liked it? Share it! ;)

Be First to Comment

Leave a Reply