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")
Enric Baltasar
Enric Baltasar

Growth Engineer. Writing about language learning, tech, and productivity.

Follow:

Comments

Have any questions or got anything to share?
Message me on or